Page MenuHomePhabricator

When page is protected against creation users don't see a message that it's protected, just no button to create an article
Closed, ResolvedPublic

Description

When an admin protects a page against creation, users don't see any messages when they visit that page, they only notice the option to create the page is missing.

afbeelding.png (188×1 px, 11 KB)

It doesn't matter if it's semi-protected or fully protected.
Currently on Dutch Wikipedia we have a work around for this. We add the page to an existing page that has been fully protected against creation with the cascade option checked. Users get to see an edit button and when they click it, they get a message that they aren't allowed to create the page:
afbeelding.png (311×1 px, 17 KB)

To see the exact reason for the protection, they need to click the link to the page that is mentioned, but at least they know what's going on.
It would be better if an admin could just protect the page and the user would see the entry from the protection log which explains why the page is protected.

Event Timeline

Similar to how that is done with deleted pages? (Example)
That depends on user rights, regular users won't see that.

That is done by modifying MediaWiki:noarticletext-nopermission. For the page used as an example, regular users don't see it as they may create the page (semi-protect). This task seems to be more than that though, being about seeing the reason for protection on the page if it can't be created.

The text is shown (missed that when making the screen shot), but people miss that text. So there must be something that stands out. Like what is shown for deleted pages.

afbeelding.png (80×1 px, 5 KB)

The text would then be something like:

  • <date> <User> protected page <name of page> because of <reason>. If you think this is a mistake, please ask for unprotection on <link to page for (un)protection requests>

Alright, so I threw together a small extension to do such a job:

ProtectedLogEntry.png (528×1 px, 44 KB)

Is this what you had in mind?
1public static function onBeforeDisplayNoArticleText( Article $article ) {
2 $title = $article->getTitle();
3
4 // Only display the log entry if the page actually is protected
5 if ( $title->isProtected() ) {
6
7 // $outputPage on LogEventsList::showLogExtract is a reference parameter,
8 // so it must be passed by means of a variable
9 $outputPage = $article->getContext()->getOutput();
10
11 LogEventsList::showLogExtract(
12 $outputPage,
13 [ 'protect' ],
14 $title,
15 '',
16 [
17 'lim' => 1,
18 'showIfEmpty' => false,
19 'msgKey' => [ 'titleprotectedwarning' ]
20 ]
21 );
22 }
23
24 return true;
25}

@Mainframe98: You want to take this to core? I've got a patch ready, but I'd defer to you, as you have all what's behind it.

@Ebe123 If you have a patch ready for core then, by all means, please do submit it. I only threw this extension snippet together as a proof of concept. I hadn't yet looked into integrating it into MediaWiki core.

Change 367033 had a related patch set uploaded (by Ebe123; owner: Ebe123):
[mediawiki/core@master] Show protection log on creation-protected pages

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

Change 367033 merged by jenkins-bot:
[mediawiki/core@master] Show protection log on creation-protected pages

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