Page MenuHomePhabricator

It should be possible to view source on protected pages in MobileFrontend Minerva
Closed, ResolvedPublic

Description

When a page is protected, on Minerva, there is no way to view the source of the article. A toast is shown telling the user it is protected, with no way to view the article wikitext. Sometimes the source is important (for example copying and pasting the content into a draft/user space).

e.g. visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Selenium_protected_test_2 in an incognito window and try to view the source of that article.
Constrast this with https://en.m.wikipedia.beta.wmflabs.org/wiki/Selenium_protected_test_2?action=edit

Original bug report

Screenshot_20181106-090234.png (1×1 px, 256 KB)

I tried clicking the locked pencil multiple times, but it did not work.

Surprisingly, it works on https://en.m.wikipedia.org/w/index.php?title=Module:Location_map

Design

image.png (1×750 px, 242 KB)

Developer notes

Related: T106943
We could show a drawer similar to the drawer we show for blocked users; the one we show for clicking a red link; and the one to prompt users to login who click the watchstar.

The drawer could provide the explanation that the page is protected but offer an option to "view source" that opens the existing editor.

We'd probably need to make some updates to the logic for the editor, to allow it to operate in read only mode.

Also related: T150189, where we also added a link to a toast message

QA steps

QA Results - Beta

ACStatusDetails
1T208827#6765641

QA Results -Prod

ACStatusDetails
1T208827#6852688

Event Timeline

Hi @Capankajsmilyo I'm going to need some more information here!

  • What browser are you using (preferably a browser user agent!)
  • What happens when you try to look on desktop?
  • Do you see the following message when you click the edit icon at the bottom of the screen?

Screen Shot 2018-11-06 at 12.49.47 PM.png (60×383 px, 8 KB)

Hi @Capankajsmilyo I'm going to need some more information here!

  • What browser are you using (preferably a browser user agent!)
  • What happens when you try to look on desktop?
  • Do you see the following message when you click the edit icon at the bottom of the screen?

Screen Shot 2018-11-06 at 12.49.47 PM.png (60×383 px, 8 KB)

I'm using Chrome

When I try in desktop view, the button view source

Screenshot_20181107-070937.png (1×1 px, 326 KB)

It shows me the source correctly
Screenshot_20181107-070945.png (1×1 px, 318 KB)

I did not see any message while tapping the button in mobile view.

Jdlrobson renamed this task from View source not working for some pages in mobile view to It should be possible to view source on protected pages in Minerva.Nov 7 2018, 6:30 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson added a project: MinervaNeue.
ovasileva triaged this task as Medium priority.Nov 13 2018, 9:14 PM

FYI @iamjessklein — this kinda sits in-between reading and editing

Have known this issue for a while. The workaround is to click and hold the lock icon until menu appears. Then choose to open the page in a new tab, that will show the source text. But it'd be great to fix this.

To clarify: is this only the case for logged-out users? When logged in I am able to view the source of (and edit) https://en.m.wikipedia.org/wiki/Barack_Obama. When logged out I get the toast message "This page is protected to prevent vandalism." If this is only an issue for logged-out users we should update the task title and description.

(from Developer notes in description)
We could show a drawer similar to the drawer we show for blocked users; the one we show for clicking a red link; and the one to prompt users to login who click the watchstar.

The drawer could provide the explanation that the page is protected but offer an option to "view source" that opens the existing editor.

That sounds like a good idea to me:

image.png (1×750 px, 175 KB)

This is a problem for both logged in and out users. It is useful to view source of pages protected from vandalism regardless of login status. Some protection levels only apply to anons and some only apply to logged in.

@Jdlrobson thanks for clarifying. Can you give an example or two of a page that this issue occurs on for logged-in users? I was unable to find any.

@Capankajsmilyo does the mockup in T208827#5127816 look good to you? If so I would like to move this out of the design column.

AntiCompositeNumber renamed this task from It should be possible to view source on protected pages in Minerva to It should be possible to view source on protected pages in MobileFrontend Minerva.Jan 23 2020, 3:43 PM

Minerva doesn't care what the edit button does, that's handled by MobileFrontend's editor.js.

Change 656392 had a related patch set uploaded (by Yash9265; owner: Yash9265):
[mediawiki/extensions/MobileFrontend@master] View Source on protected pages in MobileFrontend Minerva.

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

Jdlrobson updated the task description. (Show Details)
Jdlrobson added a subscriber: Yash4357.

Change 656392 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] View Source on protected pages in MobileFrontend Minerva.

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

Edtadros added a subscriber: Edtadros.

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Selenium_protected_test_2
Note the padlock on edit icon
Click edit
Click view source
✅ AC1: It should be possible to see the source of the article.

RPReplay_Final1611241737.mov.gif (1×888 px, 1 MB)

@Jdlrobson, you can view the source, but the page is a bit garbled. I can pass this based on the criteria, but I wanted to point out the garbling. Let me know your thoughts.

The "garbled" interface text comes from https://en.wikipedia.beta.wmflabs.org/wiki/Template:Protected_page_text via https://en.wikipedia.beta.wmflabs.org/wiki/MediaWiki:Protectedpagetext That template uses a table for layout and uses position:relative. This is fine on a desktop-size display, but doesn't work well on mobile. Similar effects occur opening the desktop site at a smaller size or high zoom level:

image.png (691×399 px, 65 KB)

The text displays fine at desktop resolution on the mobile site:

image.png (767×878 px, 124 KB)

As this issue is caused by on-wiki interface text (not MediaWiki code), it shouldn't affect the status of this patch. However, we should let the communities know that they may wish to update MediaWiki:Protectedpagetext accordingly.

Something like this for Tech News? (Plus links.)

Minerva is the skin Wikimedia wikis use for mobile traffic. When a page is protected and you can't edit it you can't see the source wikicode on Minerva on mobile devices. This is being fixed. Some text might overlap. This is because your community needs to update MediaWiki:Protectedpagetext to work on mobile. You can read more.

Something like this for Tech News? (Plus links.)

Minerva is the skin Wikimedia wikis use for mobile traffic. When a page is protected and you can't edit it you can't see the source wikicode on Minerva on mobile devices. This is being fixed. Some text might overlap. This is because your community needs to update MediaWiki:Protectedpagetext to work on mobile. You can read more.

Sounds good. Perhaps https://www.mediawiki.org/wiki/Recommendations_for_mobile_friendly_articles_on_Wikimedia_wikis#Inline_styles_should_not_use_properties_that_impact_sizing_and_positioning and https://www.mediawiki.org/wiki/Recommendations_for_mobile_friendly_articles_on_Wikimedia_wikis#Avoid_tables_for_anything_except_data may be helpful links.

The "garbled" interface text comes from https://en.wikipedia.beta.wmflabs.org/wiki/Template:Protected_page_text via https://en.wikipedia.beta.wmflabs.org/wiki/MediaWiki:Protectedpagetext That template uses a table for layout and uses position:relative. This is fine on a desktop-size display, but doesn't work well on mobile. Similar effects occur opening the desktop site at a smaller size or high zoom level:
As this issue is caused by on-wiki interface text (not MediaWiki code), it shouldn't affect the status of this patch. However, we should let the communities know that they may wish to update MediaWiki:Protectedpagetext accordingly.

@Xaosflux already fixed this half a year ago: https://en.wikipedia.org/w/index.php?title=Template:Protected_page_text&diff=962915348&oldid=946650479. I just updated the template on beta. All pages on https://www.wikidata.org/wiki/Q16323045#sitelinks-wikipedia except kowiki, mywiki, zhwiki, enwikinews, zhwiktionary and metawiki include "position:relative".

Test Result - Prod

Status: ✅ PASS
Environment: enwiki
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

Visit https://en.m.wikipedia.beta.wmflabs.org/wiki/Selenium_protected_test_2
Note the padlock on edit icon
Click edit
Click view source
✅ AC1: It should be possible to see the source of the article.

Screen Recording 2021-02-23 at 6.33.25 AM.mov.gif (896×414 px, 1 MB)