Use different message when (un)watching a page in talk namespace
authorGlaisher <glaisher.wiki@gmail.com>
Sat, 30 Jul 2016 10:05:36 +0000 (15:05 +0500)
committerReedy <reedy@wikimedia.org>
Sun, 7 Aug 2016 13:32:52 +0000 (13:32 +0000)
addedwatchtext and removedwatchtext uses the phrase "$1 and its discussion page".
As this is inaccurate on talk namespace pages, two new messages, addedwatchtext-talk
and removedwatchtext-talk, have been introduced for use in talk namespace pages.

Bug: T87856
Change-Id: Iafd86402d3a2a65ce2be007c87c981ac08f44e67

includes/actions/UnwatchAction.php
includes/actions/WatchAction.php
includes/api/ApiWatch.php
languages/i18n/en.json
languages/i18n/qqq.json

index f8f1dc1..7f043e4 100644 (file)
@@ -50,7 +50,8 @@ class UnwatchAction extends WatchAction {
        }
 
        public function onSuccess() {
-               $this->getOutput()->addWikiMsg( 'removedwatchtext', $this->getTitle()->getPrefixedText() );
+               $msgKey = $this->getTitle()->isTalkPage() ? 'removedwatchtext-talk' : 'removedwatchtext';
+               $this->getOutput()->addWikiMsg( $msgKey, $this->getTitle()->getPrefixedText() );
        }
 
        public function doesWrites() {
index 890740f..23505c0 100644 (file)
@@ -67,7 +67,8 @@ class WatchAction extends FormAction {
        }
 
        public function onSuccess() {
-               $this->getOutput()->addWikiMsg( 'addedwatchtext', $this->getTitle()->getPrefixedText() );
+               $msgKey = $this->getTitle()->isTalkPage() ? 'addedwatchtext-talk' : 'addedwatchtext';
+               $this->getOutput()->addWikiMsg( $msgKey, $this->getTitle()->getPrefixedText() );
        }
 
        /* Static utility methods */
index f09fdcb..3a7a082 100644 (file)
@@ -110,14 +110,16 @@ class ApiWatch extends ApiBase {
                        $status = UnwatchAction::doUnwatch( $title, $user );
                        $res['unwatched'] = $status->isOK();
                        if ( $status->isOK() ) {
-                               $res['message'] = $this->msg( 'removedwatchtext', $title->getPrefixedText() )
+                               $msgKey = $title->isTalkPage() ? 'removedwatchtext-talk' : 'removedwatchtext';
+                               $res['message'] = $this->msg( $msgKey, $title->getPrefixedText() )
                                        ->title( $title )->parseAsBlock();
                        }
                } else {
                        $status = WatchAction::doWatch( $title, $user );
                        $res['watched'] = $status->isOK();
                        if ( $status->isOK() ) {
-                               $res['message'] = $this->msg( 'addedwatchtext', $title->getPrefixedText() )
+                               $msgKey = $title->isTalkPage() ? 'addedwatchtext-talk' : 'addedwatchtext';
+                               $res['message'] = $this->msg( $msgKey, $title->getPrefixedText() )
                                        ->title( $title )->parseAsBlock();
                        }
                }
index bc7d78d..cddc30e 100644 (file)
        "watchnologin": "Not logged in",
        "addwatch": "Add to watchlist",
        "addedwatchtext": "\"[[:$1]]\" and its discussion page have been added to your [[Special:Watchlist|watchlist]].",
+       "addedwatchtext-talk": "\"[[:$1]]\" and its associated page have been added to your [[Special:Watchlist|watchlist]].",
        "addedwatchtext-short": "The page \"$1\" has been added to your watchlist.",
        "removewatch": "Remove from watchlist",
        "removedwatchtext": "\"[[:$1]]\" and its discussion page have been removed from your [[Special:Watchlist|watchlist]].",
+       "removedwatchtext-talk": "\"[[:$1]]\" and its associated page have been removed from your [[Special:Watchlist|watchlist]].",
        "removedwatchtext-short": "The page \"$1\" has been removed from your watchlist.",
        "watch": "Watch",
        "watchthispage": "Watch this page",
index b553756..21b6391 100644 (file)
        "watchlistanontext": "Shown on Special:Userlogin when user tries to access their watchlist before logging in",
        "watchnologin": "Used as error page title.\n\nThe error message for this title is:\n* {{msg-mw|Watchnologintext}}\n{{Identical|Not logged in}}",
        "addwatch": "Link to a dialog box, displayed at the end of the list of categories at the foot of each page.\n\nSee also:\n* {{msg-mw|Removewatch}}",
-       "addedwatchtext": "Explanation shown when clicking on the {{msg-mw|Watch}} tab. Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Addedwatch}}",
+       "addedwatchtext": "Explanation shown when clicking on the {{msg-mw|Watch}} tab in a content namespace page. Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Addedwatch}}",
+       "addedwatchtext-talk": "Explanation shown when clicking on the {{msg-mw|Watch}} tab in a talk namespace page. Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Addedwatchtext}}",
        "addedwatchtext-short": "Explanation shown when watching item from [[Special:UnwatchedPages]].\n\nSee also:\n* {{msg-mw|Removedwatchtext-short}}\n* {{msg-mw|Addedwatchtext}}",
        "removewatch": "Link to a dialog box, displayed at the end of the list of categories at the foot of each page.\n\nSee also:\n* {{msg-mw|Addwatch}}",
        "removedwatchtext": "After a page has been removed from a user's watchlist by clicking the {{msg-mw|Unwatch}} tab at the top of an article, this message appears just below the title of the article.\n\nParameters:\n* $1 - the title of the article\nSee also:\n* {{msg-mw|Removedwatch}}\n* {{msg-mw|Addedwatchtext}}",
+       "removedwatchtext-talk": "Message shown when clicking on the {{msg-mw|Unwatch}} tab in a talk namespace page.Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Removedwatchtext}}",
        "removedwatchtext-short": "Explanation shown when unwatching item from [[Special:UnwatchedPages]].\n\nSee also:\n* {{msg-mw|Addedwatchtext-short}}.\n* {{msg-mw|Removedwatchtext}}.",
        "watch": "{{doc-actionlink}}\nName of the Watch tab. Should be in the imperative mood.\n\nSee also:\n* {{msg-mw|Watch}}\n* {{msg-mw|Accesskey-ca-watch}}\n* {{msg-mw|Tooltip-ca-watch}}",
        "watchthispage": "Used as link text.\n\nSee also:\n* {{msg-mw|Unwatchthispage|link text}}\n* {{msg-mw|Notanarticle|error message}}\n{{Identical|Watch this page}}",