Page MenuHomePhabricator

Implement (part of) the English Wikipedia's edit notice system in MediaWiki core and transition the wikis to use it
Closed, ResolvedPublic40 Story Points

Description

MediaWiki core has the concept of edit notices where the contents of a MediaWiki interface message page can be shown atop the Edit page when editing.

This works by namespace or by page through these interface message:

  • MediaWiki:Editnotice-0 (applies to all pages in namespace, e.g. NS_MAIN articles)
  • MediaWiki:Editnotice-0-Sandbox (applies to page "Sandbox")
  • MediaWiki:Editnotice-2-Example (applies to page "User:Example")

The English Wikipedia (and various wikis copied this) built a template system on top of this to provide a few extra features. There are a few other aspects of this, but these are the two main use cases that I think are worth standardising:

  1. Allow non-sysops users to create edit notices.
    • Allow users to make edit notices above their user and user talk page.
    • Allow users that can edit a page, also create/edit the edit notice for that page.
  2. Display a small link on top of an edit notice pointing to where the notice can be created if it does not exist yet.

The first one is done by registering namespace-wide edit notices in all namespaces. See Special:PrefixIndex/MediaWiki:Editnotice-. Each simply contains {{editnotice load}} which basically looks for a subpage of Template:Editnotices/Page/ by the name of the page and transcludes it if it exists. Thus loading them from outside the restricted MediaWiki namespaces, and allowing non-sysops to edit it.

The second one is part of the html wrapper that {{editnotice load}} outputs even if no subpage was found. A link to the edit page to create or edit that subpage. Note that this link is hidden by default via a css class and only made visible from Sysop.css.

Because of this last part, all pages in all namespaces "have" an editnotice as far as the software is concerned. It's just invisible to most users.

I'd recommend we implement a simple mechanism by which sysops can create an interface message (e.g. MediaWiki:Editnotice-create) that (if not disabled, which it is by default) is displayed on the edit page if no edit notice was found.

Wikipedia could continue to overload the namespace via the template. As long as the template returns absolutely no content in case no edit notice is shown. Their "edit" link would only be output if an edit notice exists.

Wikipedia could continue to hide this message for non-sysops using the same class hiding.

This has the benefit of allowing software to programmatically determine whether or not an edit notice exists. This is currently impossible and forces VisualEditor and other systems to have to resort to visual style capturing to "see" if the notice is empty. Which is costly and slows down the experience for all users.

See also:

Event Timeline

Krinkle created this task.Mar 6 2015, 12:00 AM
Krinkle raised the priority of this task from to Needs Triage.
Krinkle updated the task description. (Show Details)
Krinkle added a subscriber: Krinkle.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 6 2015, 12:00 AM
Krenair renamed this task from Implement (part of) Wikipedia's edit notice system in MediaWiki core to Implement (part of) the English Wikipedia's edit notice system in MediaWiki core.Mar 6 2015, 12:08 AM
Krenair set Security to None.

Change 196426 had a related patch set uploaded (by Krinkle):
Title: Consider empty edit notices to not exist

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

Change 196466 had a related patch set uploaded (by Krinkle):
[WIP] EditPage: Implement 'editnotice-notext' message

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

Change 196426 merged by jenkins-bot:
Title: Consider empty edit notices to not exist

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

Provisionally "done" but needs implementation on-wiki once wmf23 lands there.

Change 196466 merged by jenkins-bot:
EditPage: Implement 'editnotice-notext' message

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

Next step: Convert the Template:Editnotice load template to output nothing in case no edit notices apply to the current page (not even the wrapper <div>. And move the "create" red link to MediaWiki:Editnotice-notext.

Change 198436 had a related patch set uploaded (by Jforrester):
EditPage: Implement 'editnotice-notext' message

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

Change 198436 merged by jenkins-bot:
EditPage: Implement 'editnotice-notext' message

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

Krinkle added a comment.EditedMar 29 2015, 8:20 AM

I've taken a first pass through the Editnotice load system in Beta labs. It's not pretty, but the basic thing works and looks identical to the old way.

Relevant:

Previously Template:Editnotice_load would unconditionally output the wrapper div, and then consecutively output one or more edit notices based on different sources and conditions. In order to make the wrapper div not be there if there are no notices, the main content was moved as-is to a /content subpage. The main template now loads it in an #if once, and if non-empty, wraps it in the container.

The fallback with two red links (hidden with css for most users) was moved to the /notext subpage loaded from MediaWiki:Editnotice-notext.

I verified that after these changes, the following three pages still show the same edit notices

Additionally, and this is important for VisualEditor, the following API query returns an empty notices array now.

http://en.wikipedia.beta.wmflabs.org/w/api.php?action=visualeditor&page=Sandbox&paction=parse

"notices": [],

Contrary to current prod.
http://en.wikipedia.org/w/api.php?action=visualeditor&page=Sandbox&paction=parse

"notices": {
    "editnotice-0": "<div class= .. mw-editnotice-namespace > .. editnotice-link ..
        <small><a href="/wiki/Template:Editnotices/Page/Sandbox" title="Template:Editnotices/Page/Sandbox">Page notice</a></small>..
Jdforrester-WMF renamed this task from Implement (part of) the English Wikipedia's edit notice system in MediaWiki core to Implement (part of) the English Wikipedia's edit notice system in MediaWiki core and transition the wikis to use it.Mar 30 2015, 8:27 PM
Jdforrester-WMF edited a custom field.
Jdforrester-WMF closed this task as Resolved.Mar 30 2015, 9:03 PM
Jdforrester-WMF moved this task from Polish to Done on the VisualEditor 2014/15 Q3 blockers board.
Jdforrester-WMF moved this task from Blocked to Q4 on the VisualEditor board.Mar 31 2015, 1:56 AM