Don't show dialog to confirm whether to reset watchlist
authorGeoffrey Mon <geofbot@gmail.com>
Fri, 16 Dec 2016 01:35:12 +0000 (20:35 -0500)
committerFomafix <fomafix@googlemail.com>
Fri, 16 Dec 2016 13:30:42 +0000 (14:30 +0100)
People don't seem to like having a dialog to ask for confirmation to set all
pages to visited in the watchlist, and the PHP server-side reset
functionality doesn't ask for a confirmation anyways.

Bug: T153438
Change-Id: I92aa3c0670925efc691d8bdba2c1c503e17ddb8c

languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki.special/mediawiki.special.watchlist.js

index 865aaee..882357f 100644 (file)
        "wlshowhidemine": "my edits",
        "wlshowhidecategorization": "page categorization",
        "watchlist-options": "Watchlist options",
-       "watchlist-mark-all-visited": "Are you sure you want to reset unseen watchlist changes by marking all pages as visited?",
        "watching": "Watching...",
        "unwatching": "Unwatching...",
        "watcherrortext": "An error occurred while changing your watchlist settings for \"$1\".",
index e4cfb10..d292c72 100644 (file)
        "wlshowhidemine": "Option text in [[Special:Watchlist]]. Cf. {{msg-mw|rcshowhidemine}}.",
        "wlshowhidecategorization": "Option text in [[Special:Watchlist]]. Cf. {{msg-mw|rcshowhidecategorization}}.",
        "watchlist-options": "Legend of the fieldset of [[Special:Watchlist]]\n\nSee also:\n* {{msg-mw|Watchlist-details|watchlist header}}\n* {{msg-mw|Wlheader-enotif|watchlist header}}\n* {{msg-mw|enotif reset|Submit button text}}",
-       "watchlist-mark-all-visited": "Dialog text in [[Special:Watchlist]] displayed for confirming whether the user wants to reset unseen watchlist changes by marking all pages as visited.",
        "watching": "Text displayed when clicked on the watch tab: {{msg-mw|Watch}}. It means the wiki is adding that page to your watchlist.",
        "unwatching": "Text displayed when clicked on the unwatch tab: {{msg-mw|Unwatch}}. It means the wiki is removing that page from your watchlist.",
        "watcherrortext": "When a user clicked the watch/unwatch tab and the action did not succeed, this message is displayed.\n\nThis message is used raw and should not contain wikitext.\n\nParameters:\n* $1 - ...\nSee also:\n* {{msg-mw|Addedwatchtext}}",
index 4932a29..d490414 100644 (file)
@@ -2033,11 +2033,9 @@ return [
        ],
        'mediawiki.special.watchlist' => [
                'scripts' => 'resources/src/mediawiki.special/mediawiki.special.watchlist.js',
-               'messages' => 'watchlist-mark-all-visited',
                'dependencies' => [
                        'mediawiki.api',
-                       'mediawiki.jqueryMsg',
-                       'oojs-ui-windows',
+                       'oojs-ui-core',
                        'user.options',
                ]
        ],
index 223770f..9ca98c0 100644 (file)
@@ -9,52 +9,44 @@
                // Adapted from a user script by User:NQ of English Wikipedia
                // (User:NQ/WatchlistResetConfirm.js)
                $resetForm.submit( function ( event ) {
-                       event.preventDefault();
-
-                       OO.ui.confirm( mw.msg( 'watchlist-mark-all-visited' ) )
-                       .done( function ( confirmed ) {
-                               var $button;
-
-                               if ( !confirmed ) {
-                                       return;
-                               }
+                       var $button = $resetForm.find( 'input[name=mw-watchlist-reset-submit]' );
 
-                               // Disable reset button to prevent multiple requests
-                               $button = $resetForm.find( 'input[name=mw-watchlist-reset-submit]' );
-                               $button.prop( 'disabled', true );
-
-                               // Show progress bar
-                               if ( $progressBar ) {
-                                       $progressBar.css( 'visibility', 'visible' );
-                               } else {
-                                       $progressBar = new OO.ui.ProgressBarWidget( { progress: false } ).$element;
-                                       $progressBar.css( {
-                                               position: 'absolute',
-                                               width: '100%'
-                                       } );
-                                       $resetForm.append( $progressBar );
-                               }
+                       event.preventDefault();
 
-                               // Use action=setnotificationtimestamp to mark all as visited,
-                               // then set all watchlist lines accordingly
-                               new mw.Api().postWithToken( 'csrf', {
-                                       formatversion: 2,
-                                       action: 'setnotificationtimestamp',
-                                       entirewatchlist: true
-                               } ).done( function () {
-                                       // Enable button again
-                                       $button.prop( 'disabled', false );
-                                       // Hide the button because further clicks can not generate any visual changes
-                                       $button.css( 'visibility', 'hidden' );
-                                       $progressBar.css( 'visibility', 'hidden' );
-                                       $( '.mw-changeslist-line-watched' )
-                                               .removeClass( 'mw-changeslist-line-watched' )
-                                               .addClass( 'mw-changeslist-line-not-watched' );
-                               } ).fail( function () {
-                                       // On error, fall back to server-side reset
-                                       // First remove this submit listener and then re-submit the form
-                                       $resetForm.off( 'submit' ).submit();
+                       // Disable reset button to prevent multiple concurrent requests
+                       $button.prop( 'disabled', true );
+
+                       // Show progress bar
+                       if ( $progressBar ) {
+                               $progressBar.css( 'visibility', 'visible' );
+                       } else {
+                               $progressBar = new OO.ui.ProgressBarWidget( { progress: false } ).$element;
+                               $progressBar.css( {
+                                       position: 'absolute',
+                                       width: '100%'
                                } );
+                               $resetForm.append( $progressBar );
+                       }
+
+                       // Use action=setnotificationtimestamp to mark all as visited,
+                       // then set all watchlist lines accordingly
+                       new mw.Api().postWithToken( 'csrf', {
+                               formatversion: 2,
+                               action: 'setnotificationtimestamp',
+                               entirewatchlist: true
+                       } ).done( function () {
+                               // Enable button again
+                               $button.prop( 'disabled', false );
+                               // Hide the button because further clicks can not generate any visual changes
+                               $button.css( 'visibility', 'hidden' );
+                               $progressBar.css( 'visibility', 'hidden' );
+                               $( '.mw-changeslist-line-watched' )
+                                       .removeClass( 'mw-changeslist-line-watched' )
+                                       .addClass( 'mw-changeslist-line-not-watched' );
+                       } ).fail( function () {
+                               // On error, fall back to server-side reset
+                               // First remove this submit listener and then re-submit the form
+                               $resetForm.off( 'submit' ).submit();
                        } );
                } );