Page MenuHomePhabricator

Create a dedicated component to select files from Commons
Closed, ResolvedPublic

Description

In order to create a better UX for filling up the icon/logo field we could make use of existing PageTitles component in CommunityConfiguration or create a dedicated one.

Open questions

  • Are the thumbnails necessary? Or this could be a variant of PageTitles targetting the File namespace?

Event Timeline

The problem I see for re-using the existing PageTitles selector in this use-case is the need for resolving T367494: Community configuration: Add support for parametrised controls. We could add controlData to the existing extended vocabulary but it seems we're building UI schema just for "custom controls".

Change #1054294 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/CommunityConfiguration@master] JsonForm: add CommonsFileControl

https://gerrit.wikimedia.org/r/1054294

Sgs triaged this task as High priority.Jul 15 2024, 12:02 PM

Change #1054294 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] JsonForm: add CommonsFileControl

https://gerrit.wikimedia.org/r/1054294

Etonkovidova subscribed.

Currently it's not possible to test in betacluster - moving to Test in Production column; it'd be great to test in in testwiki.

Currently it's not possible to test in betacluster - moving to Test in Production column; it'd be great to test in in testwiki.

I can see the control for the Image field in beta, Special:CommunityConfiguration/CommunityUpdates. Is there something I'm missing?

Currently it's not possible to test in betacluster - moving to Test in Production column; it'd be great to test in in testwiki.

I can see the control for the Image field in beta, Special:CommunityConfiguration/CommunityUpdates. Is there something I'm missing?

Yes, the component is there. I wanted to check if images from commons beta are available since the task title mentions commons - "Create a dedicated component to select files from Commons". Presently, only images uploaded to a specific wiki, in this case eswiki beta, are accepted in the field.

For example, File:Women in Red logo.svg exists on eswiki beta as https://es.wikipedia.beta.wmflabs.org/wiki/Archivo:Women_in_Red_logo.svg. and it'd be in the suggestions on Special:CommunityConfiguration/CommunityUpdates:

Screen Shot 2024-09-03 at 4.13.47 PM.png (856×1 px, 164 KB)

Also, adding will add url "https://upload.wikimedia.org/wikipedia/commons/c/c7/Women_in_Red_logo.svg"
But File:Azalia test1.jpg exists only on commons beta - https://commons.wikimedia.beta.wmflabs.org/wiki/File:Azalia_test1.jpg. Image field won't list this file in suggestions:
Screen Shot 2024-09-03 at 4.28.52 PM.png (1×1 px, 158 KB)

And a placeholder will be displayed:
Screen Shot 2024-09-03 at 4.29.27 PM.png (664×738 px, 61 KB)

VisualEditor would recognize that File:Azalia test1.jpg is on commons (there is a betalabs problem with displaying images from commons beta):

Screen Shot 2024-09-03 at 4.16.09 PM.png (1×2 px, 125 KB)

The question: Should the Image field accept images from commons?

Change #1070562 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[operations/mediawiki-config@master] Add wgCommunityConfigurationCommonsApiURL

https://gerrit.wikimedia.org/r/1070562

Change #1070572 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/CommunityConfiguration@master] CommonsFileControl: use config variable for the commons api url

https://gerrit.wikimedia.org/r/1070572

Change #1070573 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/GrowthExperiments@master] CommunityUpdates: use CommunityConfiguration config variable for commons files

https://gerrit.wikimedia.org/r/1070573

Thank you for the detailed review.

Yes, the component is there. I wanted to check if images from commons beta are available since the task title mentions commons - "Create a dedicated component to select files from Commons". Presently, only images uploaded to a specific wiki, in this case eswiki beta, are accepted in the field.

That is not accurate, presently, only images from (production) commons are accepted in the field. That is because the control was not configured to work with different file sources, just commons, so images uploaded to the local wiki should not be listed.

For example, File:Women in Red logo.svg exists on eswiki beta as https://es.wikipedia.beta.wmflabs.org/wiki/Archivo:Women_in_Red_logo.svg. and it'd be in the suggestions on Special:CommunityConfiguration/CommunityUpdates:

Screen Shot 2024-09-03 at 4.13.47 PM.png (856×1 px, 164 KB)

Also, adding will add url "https://upload.wikimedia.org/wikipedia/commons/c/c7/Women_in_Red_logo.svg"

The file is listed because it exists in (production) commons, I'm not sure how the File namespace works for the image to be listed in https://es.wikipedia.beta.wmflabs.org/wiki/Archivo:Women_in_Red_logo.svg, but I think this does not imply the image is uploaded to the local wiki.

But File:Azalia test1.jpg exists only on commons beta - https://commons.wikimedia.beta.wmflabs.org/wiki/File:Azalia_test1.jpg. Image field won't list this file in suggestions:

Screen Shot 2024-09-03 at 4.28.52 PM.png (1×1 px, 158 KB)

And a placeholder will be displayed:
Screen Shot 2024-09-03 at 4.29.27 PM.png (664×738 px, 61 KB)

I think Azalia_test1 is not being listed because it does not exist in production commons, but I can also find the image in https://es.wikipedia.beta.wmflabs.org/wiki/Archivo:Azalia_test1.jpg, so I'm not sure if the presence of the URL is enough to say the image exists in the local wiki.

VisualEditor would recognize that File:Azalia test1.jpg is on commons (there is a betalabs problem with displaying images from commons beta):

Screen Shot 2024-09-03 at 4.16.09 PM.png (1×2 px, 125 KB)

Indeed, we should fix the control so it gets the right environment API (betalabs vs commons). Amended in 1070573, 1070572, I will ping you again once it can be tested.

The question: Should the Image field accept images from commons?

Yes, indeed it should. The lack of support for local wiki images was brought in code review and we decided to leave it for a follow-up, see T370404: Make CommonsFileControl more generic

Thx, @Sgs! I assumed that only commons beta images could go in the Image. field. I tested images from commons production - all works as expected.

I'm not sure how the File namespace works for the image to be listed in https://es.wikipedia.beta.wmflabs.org/wiki/Archivo:Women_in_Red_logo.svg, but I think this does not imply the image is uploaded to the local wiki.

It seems that if a file gets displayed on a wiki, it is uploaded. For example, when I added to the Image field https://commons.wikimedia.org/wiki/File:Oregon_flowers_dunes_test.jpg, the file info was added as

title	"File:Oregon flowers dunes test.jpg"
url	"https://upload.wikimedia.org/wikipedia/commons/d/dd/Oregon_flowers_dunes_test.jpg"

(see this rvision: https://es.wikipedia.beta.wmflabs.org/w/index.php?title=MediaWiki:GrowthExperimentsCommunityUpdates.json&oldid=34487). The file page was created: https://es.wikipedia.beta.wmflabs.org/wiki/Archivo:Oregon_flowers_dunes_test.jpg

Change #1070562 merged by jenkins-bot:

[operations/mediawiki-config@master] Add wgCommunityConfigurationCommonsApiURL

https://gerrit.wikimedia.org/r/1070562

Mentioned in SAL (#wikimedia-operations) [2024-09-25T13:06:58Z] <sgimeno@deploy1003> Started scap sync-world: Backport for [[gerrit:1070562|Add wgCommunityConfigurationCommonsApiURL (T369069)]]

Mentioned in SAL (#wikimedia-operations) [2024-09-25T13:09:06Z] <sgimeno@deploy1003> sgimeno: Backport for [[gerrit:1070562|Add wgCommunityConfigurationCommonsApiURL (T369069)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-09-25T13:15:04Z] <sgimeno@deploy1003> Finished scap sync-world: Backport for [[gerrit:1070562|Add wgCommunityConfigurationCommonsApiURL (T369069)]] (duration: 08m 06s)

Change #1070572 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] CommonsFileControl: use config variable for the commons api url

https://gerrit.wikimedia.org/r/1070572

Change #1070573 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] CommunityUpdates: use CommunityConfiguration config variable for commons files

https://gerrit.wikimedia.org/r/1070573