Add GENDER support to protection null revision edit summary
authorThis, that and the other <at.light@live.com.au>
Fri, 11 Dec 2015 08:26:05 +0000 (19:26 +1100)
committerTTO <at.light@live.com.au>
Fri, 4 Nov 2016 06:01:31 +0000 (06:01 +0000)
The edit summary for protection null revisions are still messy
"Lego messages", but now with GENDER support.

The message documentation (qqq) for "protectedarticle",
"modifiedarticleprotection", and "unprotectedarticle" was incorrect, but
now matches the fact that these are IRC-only messages.

Bug: T121091
Change-Id: Ia1151fb5aab8334d3351588531fcdac499fcc486

includes/page/WikiPage.php
languages/i18n/en.json
languages/i18n/qqq.json

index 294a22c..23e0887 100644 (file)
@@ -2444,13 +2444,13 @@ class WikiPage implements Page, IDBAccessObject {
                }
 
                if ( !$protect ) { // No protection at all means unprotection
-                       $revCommentMsg = 'unprotectedarticle';
+                       $revCommentMsg = 'unprotectedarticle-comment';
                        $logAction = 'unprotect';
                } elseif ( $isProtected ) {
-                       $revCommentMsg = 'modifiedarticleprotection';
+                       $revCommentMsg = 'modifiedarticleprotection-comment';
                        $logAction = 'modify';
                } else {
-                       $revCommentMsg = 'protectedarticle';
+                       $revCommentMsg = 'protectedarticle-comment';
                        $logAction = 'protect';
                }
 
@@ -2627,16 +2627,14 @@ class WikiPage implements Page, IDBAccessObject {
        public function insertProtectNullRevision( $revCommentMsg, array $limit,
                array $expiry, $cascade, $reason, $user = null
        ) {
-               global $wgContLang;
                $dbw = wfGetDB( DB_MASTER );
 
                // Prepare a null revision to be added to the history
-               $editComment = $wgContLang->ucfirst(
-                       wfMessage(
-                               $revCommentMsg,
-                               $this->mTitle->getPrefixedText()
-                       )->inContentLanguage()->text()
-               );
+               $editComment = wfMessage(
+                       $revCommentMsg,
+                       $this->mTitle->getPrefixedText(),
+                       $user ? $user->getName() : ''
+               )->inContentLanguage()->text();
                if ( $reason ) {
                        $editComment .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $reason;
                }
index 70a2b80..e756ed0 100644 (file)
        "modifiedarticleprotection": "changed protection level for \"[[$1]]\"",
        "unprotectedarticle": "removed protection from \"[[$1]]\"",
        "movedarticleprotection": "moved protection settings from \"[[$2]]\" to \"[[$1]]\"",
+       "protectedarticle-comment": "{{GENDER:$2|Protected}} \"[[$1]]\"",
+       "modifiedarticleprotection-comment": "{{GENDER:$2|Changed protection level}} for \"[[$1]]\"",
+       "unprotectedarticle-comment": "{{GENDER:$2|Removed protection}} from \"[[$1]]\"",
        "protect-title": "Change protection level for \"$1\"",
        "protect-title-notallowed": "View protection level of \"$1\"",
        "prot_1movedto2": "[[$1]] moved to [[$2]]",
index fc72a4b..7be67cf 100644 (file)
        "modifiedarticleprotection": "This is a ''logentry'' message only used on IRC.\nText describing an action. $1 is a page title.",
        "unprotectedarticle": "This is a ''logentry'' message only used on IRC.\nUsed as action. Parameters:\n* $1 - target page title",
        "movedarticleprotection": "This is a ''logentry'' message only used on IRC. It appears in the log if a protected page is renamed.\n\nExample:\n<code>00:51, 16 September 2010 Siebrand +(Talk • contribs • block) moved protection settings from \"User:Siebrand/prot-move\" to \"User:Siebrand/prot-moved\" ‎ (User:Siebrand/prot-move moved to User:Siebrand/prot-moved: prot_move test.)</code>\n\nParameters:\n* $1 - target page title\n* $2 - source page title",
+       "protectedarticle-comment": "Used as part of the edit summary placed in the page history when a page is protected.\n\nParameters:\n* $1 - page title\n* $2 - user who carried out the action (should only be used in the <code>GENDER</code> magic word)",
+       "modifiedarticleprotection-comment": "Used as part of the edit summary placed in the page history when a page's protection settings are modified.\n\nParameters:\n* $1 - page title\n* $2 - user who carried out the action (should only be used in the <code>GENDER</code> magic word)",
+       "unprotectedarticle-comment": "Used as part of the edit summary placed in the page history when a page is unprotected.\n\nParameters:\n* $1 - page title\n* $2 - user who carried out the action (should only be used in the <code>GENDER</code> magic word)",
        "protect-title": "Title for the protection form. $1 is the title of the page to be (un)protected.",
        "protect-title-notallowed": "Same as {{msg-mw|Protect-title}}, but when the user does not have the right to change protection levels.\n\nParameters:\n* $1 - page title",
        "prot_1movedto2": "Message description: [[mw:Manual:Interface/1movedto2]]\n\nParameters:\n* $1 - source page title\n* $2 - target page title",