Sn1per has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/327684 )

Change subject: Don't show dialog to confirm whether to reset watchlist
......................................................................

Don't show dialog to confirm whether to reset watchlist

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: T150045
Change-Id: I92aa3c0670925efc691d8bdba2c1c503e17ddb8c
---
M languages/i18n/en.json
M languages/i18n/qqq.json
M resources/Resources.php
M resources/src/mediawiki.special/mediawiki.special.watchlist.js
4 files changed, 21 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/84/327684/1

diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 865aaee..882357f 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -2114,7 +2114,6 @@
        "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\".",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index e4cfb10..d292c72 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -2298,7 +2298,6 @@
        "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}}",
diff --git a/resources/Resources.php b/resources/Resources.php
index 4932a29..7cf6867 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -2036,8 +2036,6 @@
                'messages' => 'watchlist-mark-all-visited',
                'dependencies' => [
                        'mediawiki.api',
-                       'mediawiki.jqueryMsg',
-                       'oojs-ui-windows',
                        'user.options',
                ]
        ],
diff --git a/resources/src/mediawiki.special/mediawiki.special.watchlist.js 
b/resources/src/mediawiki.special/mediawiki.special.watchlist.js
index bfe2c1c..9e7db46 100644
--- a/resources/src/mediawiki.special/mediawiki.special.watchlist.js
+++ b/resources/src/mediawiki.special/mediawiki.special.watchlist.js
@@ -1,7 +1,7 @@
 /*!
  * JavaScript for Special:Watchlist
  */
-( function ( mw, $, OO ) {
+( function ( mw, $ ) {
        $( function () {
                var $resetForm = $( '#mw-watchlist-resetbutton' ),
                        $progressBar = new OO.ui.ProgressBarWidget( { progress: 
false } ).$element;
@@ -19,33 +19,26 @@
                $resetForm.submit( function ( event ) {
                        event.preventDefault();
 
-                       OO.ui.confirm( mw.msg( 'watchlist-mark-all-visited' ) 
).done( function ( confirmed ) {
-                               var $button;
+                       // Disable reset button to prevent multiple concurrent 
requests and show progress bar
+                       $button = $resetForm.find( 
'input[name=mw-watchlist-reset-submit]' ).prop( 'disabled', true );
+                       $progressBar.css( 'visibility', 'visible' );
 
-                               if ( confirmed ) {
-                                       // Disable reset button to prevent 
multiple requests and show progress bar
-                                       $button = $resetForm.find( 
'input[name=mw-watchlist-reset-submit]' ).prop( 'disabled', true );
-                                       $progressBar.css( 'visibility', 
'visible' );
-
-                                       // 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 () {
-                                               $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();
-                                       } );
-
-                               }
+                       // 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 () {
+                               $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();
                        } );
                } );
 
@@ -59,4 +52,4 @@
                }
        } );
 
-}( mediaWiki, jQuery, OO ) );
+}( mediaWiki, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/327684
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I92aa3c0670925efc691d8bdba2c1c503e17ddb8c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Sn1per <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to