Page MenuHomePhabricator

Run in all content namespaces
Closed, ResolvedPublic3 Estimated Story PointsFeature

Description

I often work through pages in Category:Author pages not connected to Wikidata, and it'd be great if AutosuggestSitelink would run for these pages. Currently, it only works in the main namespace.

Details

TitleReferenceAuthorSource BranchDest Branch
Allow to run in all content namespacesrepos/commtech/autosuggest-sitelink!26samwilsoncontent-namespacesmain
Customize query in GitLab

Event Timeline

MR merged! @Samwilson Did you want to point this task and move it to the sprint? I realize you worked on this weeks ago; Sorry it took so long to get it merged :/

I'd totally forgotten about it! Thanks for reviewing and merging. Will move to QA now.

Samwilson set the point value for this task to 2.Mar 23 2023, 10:47 PM
Samwilson moved this task from Ready 🎬 to QA 🐛 on the Community-Tech (CommTech-Sprint-42) board.

@Samwilson, @GMikesell-WMF and I got together to test this issue and we found that there are some inconsistencies.

Is editing https://en.wikisource.org/wiki/Category:Author_pages_not_connected_to_Wikidata supposed to trigger the popup? It is not working for us. I'm assuming Category is a content namespace based on https://www.mediawiki.org/wiki/Help:Namespaces#Renaming_namespaces.

We are loading the code from https://test.wikipedia.org/wiki/User:HMonroy_(WMF)/AutosuggestSitelink.js, which is where I placed the latest code including this patch.

Please advise, not sure if we are missing something. Thank you!

Is editing https://en.wikisource.org/wiki/Category:Author_pages_not_connected_to_Wikidata supposed to trigger the popup? It is not working for us. I'm assuming Category is a content namespace based on https://www.mediawiki.org/wiki/Help:Namespaces#Renaming_namespaces.

Category is not a content namespace. By default, the only content namespace is NS_MAIN. $wgContentNamespaces configures them. For enwikisource, the content namespaces are 0 (NS_MAIN), 102 (Author), 104 (Page), 106 (Index), and 114 (Translation).

https://en.wikisource.org/wiki/Author:Adalbold_II_of_Utrecht does not trigger the popup at all, not expected.

This one is already connected to Wikidata, so it shouldn't trigger the popup.


It's a good point about categories not being content (b.t.w. you can check what's content and not via the API). I don't think on Wikisource it matters too much but definitely on Commons it'd be good to have the popup appear on categories. And also on Commons, it's been annoying me that AutosuggestSitelink does now function for File pages (which are content) — it's pretty rare that a File page should have a sitelink.

So maybe just adding content namespaces isn't enough. Do we also need a per-wiki config? Or could we disable for File everywhere and enable for Category everywhere?

https://en.wikisource.org/wiki/Author:Adalbold_II_of_Utrecht does not trigger the popup at all, not expected.

This one is already connected to Wikidata, so it shouldn't trigger the popup.

Duh!! Sorry about the noise, I didn't think about that.

So maybe just adding content namespaces isn't enough. Do we also need a per-wiki config? Or could we disable for File everywhere and enable for Category everywhere?

We can include Category and disable for File pages. I'm learning about about these use cases as we go :) So the content namespaces are different per-wiki? Then it sounds like we do need a config per-wiki since we need to pick and choose where the popup should be triggered. Would this get too messy?

We can include Category and disable for File pages. I'm learning about about these use cases as we go :) So the content namespaces are different per-wiki? Then it sounds like we do need a config per-wiki since we need to pick and choose where the popup should be triggered. Would this get too messy?

I think special handling for those two categories would be good, and hopefully we can avoid per-wiki config for now (it's just extra complexity). I can't think of any wikis that would want to add sitelinks for files (not that that means anything!).

@Samwilson The good news is that Autosuggest doesn't pop up in Beta Commons anymore if that's what you wanted.
The latest code is on https://test.wikipedia.org/w/index.php?title=User:HMonroy_(WMF)/AutosuggestSitelink.js&action=raw&ctype=text/javascript
Beta Commons Test link: https://commons.wikimedia.beta.wmflabs.org/wiki/File:Icon_for_char_%E8%AD%9D_bluejay_platinum_32x32.png

The issue I'm getting with the latest code is that it seems like AutoSuggest doesn't work in general as seen in the screenshot below with the error
OS: macOS 13.3
Browser: Chrome 112
Skin: Vector 2022
Test link: https://test.wikipedia.org/wiki/Mandrill#

Uncaught TypeError: validNamespaces.indexOf is not a function

at init (https://test.wikipedia.org/w/index.php?title=User:HMonroy_(WMF)/AutosuggestSitelink.js&action=raw&ctype=text/javascript:214:24)
at HTMLLIElement.<anonymous> (https://test.wikipedia.org/w/index.php?title=User:HMonroy_(WMF)/AutosuggestSitelink.js&action=raw&ctype=text/javascript:232:5)
at HTMLLIElement.dispatch (load.php?lang=en&mod…rsion=1ld46:256:260)
at elemData.handle (load.php?lang=en&mod…rsion=1ld46:252:877)

T330972_Autosuggest_Popup_error.png (1×3 px, 630 KB)

I totally got the validNamespaces list wrong! Oops. Fix above is ready for review.

HMonroy changed the point value for this task from 2 to 3.Apr 26 2023, 7:47 PM