Add links to Special:EditWatchlist in Preferences' Watchlist tab
authorglaisher <glaisher.wiki@gmail.com>
Tue, 20 Jan 2015 17:00:21 +0000 (22:00 +0500)
committerglaisher <glaisher.wiki@gmail.com>
Sat, 24 Jan 2015 15:52:24 +0000 (20:52 +0500)
This adds a new "Edit watchlist" section to Watchlist tab with links
to Special:EditWatchlist, EditWatchlist/raw and EditWatchlist/clear.

Bug: T26632
Change-Id: Id31fba4f7aadaa3e427becece3837a8d00b7718f

includes/Preferences.php
languages/i18n/en.json
languages/i18n/qqq.json

index 9e0a255..84d4189 100644 (file)
@@ -919,6 +919,30 @@ class Preferences {
                $watchlistdaysMax = ceil( $config->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
 
                ## Watchlist #####################################
                $watchlistdaysMax = ceil( $config->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
 
                ## Watchlist #####################################
+               if ( $user->isAllowed( 'editmywatchlist' ) ) {
+                       $editWatchlistLinks = array();
+                       $editWatchlistModes = array(
+                               'edit' => array( 'EditWatchlist', false ),
+                               'raw' => array( 'EditWatchlist', 'raw' ),
+                               'clear' => array( 'EditWatchlist', 'clear' ),
+                       );
+                       foreach ( $editWatchlistModes as $editWatchlistMode => $mode ) {
+                               // Messages: prefs-editwatchlist-edit, prefs-editwatchlist-raw, prefs-editwatchlist-clear
+                               $editWatchlistLinks[] = Linker::linkKnown(
+                                       SpecialPage::getTitleFor( $mode[0], $mode[1] ),
+                                       $context->msg( "prefs-editwatchlist-{$editWatchlistMode}" )->parse()
+                               );
+                       }
+
+                       $defaultPreferences['editwatchlist'] = array(
+                               'type' => 'info',
+                               'raw' => true,
+                               'default' => $context->getLanguage()->pipeList( $editWatchlistLinks ),
+                               'label-message' => 'prefs-editwatchlist-label',
+                               'section' => 'watchlist/editwatchlist',
+                       );
+               }
+
                $defaultPreferences['watchlistdays'] = array(
                        'type' => 'float',
                        'min' => 0,
                $defaultPreferences['watchlistdays'] = array(
                        'type' => 'float',
                        'min' => 0,
index 56a2ee4..e701137 100644 (file)
        "prefs-personal": "User profile",
        "prefs-rc": "Recent changes",
        "prefs-watchlist": "Watchlist",
        "prefs-personal": "User profile",
        "prefs-rc": "Recent changes",
        "prefs-watchlist": "Watchlist",
+       "prefs-editwatchlist": "Edit watchlist",
+       "prefs-editwatchlist-label": "Edit entries on your watchlist:",
+       "prefs-editwatchlist-edit": "View and remove titles on your watchlist",
+       "prefs-editwatchlist-raw": "Edit raw watchlist",
+       "prefs-editwatchlist-clear": "Clear your watchlist",
        "prefs-watchlist-days": "Days to show in watchlist:",
        "prefs-watchlist-days-max": "Maximum $1 {{PLURAL:$1|day|days}}",
        "prefs-watchlist-edits": "Maximum number of changes to show in expanded watchlist:",
        "prefs-watchlist-days": "Days to show in watchlist:",
        "prefs-watchlist-days-max": "Maximum $1 {{PLURAL:$1|day|days}}",
        "prefs-watchlist-edits": "Maximum number of changes to show in expanded watchlist:",
index 14345bf..20fe0d6 100644 (file)
        "prefs-watchlist-edits": "Used in [[Special:Preferences]], tab \"Watchlist\".",
        "prefs-watchlist-edits-max": "Shown as hint in [[Special:Preferences]], tab \"Watchlist\"",
        "prefs-watchlist-token": "Used in [[Special:Preferences]], tab Watchlist.",
        "prefs-watchlist-edits": "Used in [[Special:Preferences]], tab \"Watchlist\".",
        "prefs-watchlist-edits-max": "Shown as hint in [[Special:Preferences]], tab \"Watchlist\"",
        "prefs-watchlist-token": "Used in [[Special:Preferences]], tab Watchlist.",
+       "prefs-editwatchlist": "Used in [[Special:Preferences]], tab \"Watchlist\".",
+       "prefs-editwatchlist-label": "Used in [[Special:Preferences]], tab \"Watchlist\".",
+       "prefs-editwatchlist-edit": "Used in [[Special:Preferences]], tab \"Watchlist\". Link to [[Special:EditWatchlist]]\n\nSee also:\n* {{msg-mw|prefs-editwatchlist-clear}}\n* {{msg-mw|prefs-editwatchlist-raw}}",
+       "prefs-editwatchlist-raw": "Used in [[Special:Preferences]], tab \"Watchlist\". Link to [[Special:EditWatchlist/raw]].\n\nSee also:\n* {{msg-mw|prefs-editwatchlist-edit}}\n* {{msg-mw|prefs-editwatchlist-clear}}\n{{Identical|Edit raw watchlist}}",
+       "prefs-editwatchlist-clear": "Used in [[Special:Preferences]], tab \"Watchlist\". Link to [[Special:EditWatchlist/clear]].\n\nSee also:\n* {{msg-mw|prefs-editwatchlist-edit}}\n* {{msg-mw|prefs-editwatchlist-raw}}\n{{Identical|Clear watchlist}}",
        "prefs-misc": "Tab used on the [[Special:Preferences|user preferences]] special page.",
        "prefs-resetpass": "Button on user data tab in user preferences. When you click the button you go to the special page [[Special:ResetPass]].\n\n{{Identical|Change password}}",
        "prefs-changeemail": "Link on [[Special:Preferences]] to [[Special:ChangeEmail]].\n\nSee also:\n* {{msg-mw|prefs-help-email-required|help}}\n* {{msg-mw|prefs-help-email|help}}\n* {{msg-mw|prefs-help-email-others|help}}\n* {{msg-mw|prefs-setemail|link title}}",
        "prefs-misc": "Tab used on the [[Special:Preferences|user preferences]] special page.",
        "prefs-resetpass": "Button on user data tab in user preferences. When you click the button you go to the special page [[Special:ResetPass]].\n\n{{Identical|Change password}}",
        "prefs-changeemail": "Link on [[Special:Preferences]] to [[Special:ChangeEmail]].\n\nSee also:\n* {{msg-mw|prefs-help-email-required|help}}\n* {{msg-mw|prefs-help-email|help}}\n* {{msg-mw|prefs-help-email-others|help}}\n* {{msg-mw|prefs-setemail|link title}}",