kynikos / wiki-monkey

MediaWiki-compatible bot and editor assistant running directly in the browser and expandable with plugins.
https://github.com/kynikos/wiki-monkey/wiki
GNU General Public License v3.0
15 stars 5 forks source link

Section heading "shortcuts" not visible on protected pages #250

Closed kattjevfel closed 3 years ago

kattjevfel commented 3 years ago

When viewing a protected page as a regular user makes none of the shortcuts show up next to section headings. I can understand the edit button being gone, but the rest are very useful still.

Problem: 2021-05-24_17-05-01

Example of them being visible: 2021-05-24_17-06-42

kynikos commented 3 years ago

Yep, WM looks for mw-editsection class elements to inject those links, and clearly MediaWiki doesn't render them for users without edit rights on the page... I've got to find another reliable way to identify sections.

https://github.com/kynikos/wiki-monkey/blob/bcfef4fcdbbc8aced86490dd73ff6e9f9a1a6bf2/src/app/index.js#L85

kattjevfel commented 3 years ago

The update seems to have brought the side effect that translations of (English) pages I can't edit, also doesn't show the edit button.

2021-05-29_01-15-54 I have access to edit this page but the edit button is gone :p

kynikos commented 3 years ago

Most main pages have the __NOEDITSECTION__ switch at the top, which hides edit buttons, I'm pretty sure "Main page (Svenska)" didn't have links even before, so the behaviour would be expected. Can you confirm that this only happens in pages with __NOEDITSECTION__?

kattjevfel commented 3 years ago

Oh, I guess that is it then, I just blindly copied the __NOTOC__ __NOEDITSECTION__ when making my translation. But I'm 99% sure they were there before.

kynikos commented 3 years ago

Hmm if the links had been there before, it would mean that __NOEDITSECTION__ wasn't working... Anyway, technically I could very easily add the edit buttons even when natively they'd be missing from the page because of __NOEDITSECTION__, however 1) they'd also appear in pages where the user doesn't have edit privileges (unless I found another way to prevent that), and 2) it would practically become an override of __NOEDITSECTION__, while the proper way to make the links appear would actually be to simply remove that flag from the page.