From 836b5592e95a711c291e9809bc07ade1093f012c Mon Sep 17 00:00:00 2001 From: zanhecht <797985+zanhecht@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:11:47 -0500 Subject: [PATCH 1/6] Add options.watchlist to editPage --- src/modules/core.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/core.js b/src/modules/core.js index ccb4ce03..9354f678 100644 --- a/src/modules/core.js +++ b/src/modules/core.js @@ -651,6 +651,10 @@ request.minor = 'true'; } + if ( ['nochange', 'unwatch', 'watch'].includes(options.watchlist) ) { + request.watchlist = options.watchlist; + } + // Depending on mode, set appendtext=text or prependtext=text, // which overrides the default text option if ( options.mode ) { From 4d57007411cd13d9a80cf9b61ff4594bae71c46a Mon Sep 17 00:00:00 2001 From: zanhecht <797985+zanhecht@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:13:10 -0500 Subject: [PATCH 2/6] Don't add recentPage to watchlist --- src/modules/submissions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/submissions.js b/src/modules/submissions.js index 702c30f4..92bda0d2 100644 --- a/src/modules/submissions.js +++ b/src/modules/submissions.js @@ -2364,7 +2364,8 @@ recentPage.edit( { contents: newRecentText, - summary: 'Adding [[' + newPage + ']] to list of recent AfC creations' + summary: 'Adding [[' + newPage + ']] to list of recent AfC creations', + watchlist: 'nochange' } ); } ); From a91be54e182c780ef52d8083ce06876309819b15 Mon Sep 17 00:00:00 2001 From: zanhecht <797985+zanhecht@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:23:02 -0500 Subject: [PATCH 3/6] Resolve linter errors resolve array-bracket-spacing and space-in-parens --- src/modules/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/core.js b/src/modules/core.js index 9354f678..94328409 100644 --- a/src/modules/core.js +++ b/src/modules/core.js @@ -651,7 +651,7 @@ request.minor = 'true'; } - if ( ['nochange', 'unwatch', 'watch'].includes(options.watchlist) ) { + if ( [ 'nochange', 'unwatch', 'watch' ].includes( options.watchlist ) ) { request.watchlist = options.watchlist; } From 89656d39e32ab2a616deb935afd063ebf29fbea2 Mon Sep 17 00:00:00 2001 From: zanhecht <797985+zanhecht@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:56:10 -0500 Subject: [PATCH 4/6] Set watchlist based on hidden noWatch preference If the hidden (for now) noWatch preference is set, the watchlist parameter of the edit and move API calls will be set to 'nochange' (unless it is an edit request and the options.watchlist parameter is set to a valid value) --- src/modules/core.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/core.js b/src/modules/core.js index 94328409..c9ee3bc6 100644 --- a/src/modules/core.js +++ b/src/modules/core.js @@ -651,8 +651,10 @@ request.minor = 'true'; } - if ( [ 'nochange', 'unwatch', 'watch' ].includes( options.watchlist ) ) { + if ( [ 'nochange', 'preferences', 'unwatch', 'watch' ].includes( options.watchlist ) ) { request.watchlist = options.watchlist; + } else if ( AFCH.prefs.noWatch ) { + request.watchlist = 'nochange'; } // Depending on mode, set appendtext=text or prependtext=text, @@ -740,6 +742,10 @@ reason: reason + AFCH.consts.summaryAd }, additionalParameters ); + if ( AFCH.prefs.noWatch ) { + request.watchlist = 'nochange'; + } + if ( AFCH.consts.mockItUp ) { AFCH.log( request ); deferred.resolve( { to: newTitle } ); @@ -1218,7 +1224,8 @@ autoOpen: false, logCsd: true, launchLinkPosition: 'p-cactions', - logAfc: false + logAfc: false, + noWatch: false }; /** From 687f09cbf3b93b84797663109c5112fe9c3a5c1b Mon Sep 17 00:00:00 2001 From: zanhecht <797985+zanhecht@users.noreply.github.com> Date: Tue, 7 Nov 2023 23:14:19 -0500 Subject: [PATCH 5/6] Add noWatch checkbox to preferences Add checkbox for "Do not add pages to watchlist" --- src/templates/tpl-preferences.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/templates/tpl-preferences.html b/src/templates/tpl-preferences.html index 7f95f34c..4f0bcf15 100644 --- a/src/templates/tpl-preferences.html +++ b/src/templates/tpl-preferences.html @@ -25,6 +25,10 @@ +
+ + +
From b1795983067a0103cb9eaaf3840f8ae006c8749c Mon Sep 17 00:00:00 2001 From: NovemLinguae Date: Mon, 15 Apr 2024 18:13:35 -0700 Subject: [PATCH 6/6] improve docblock --- src/modules/core.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/core.js b/src/modules/core.js index c8c21427..69837ef5 100644 --- a/src/modules/core.js +++ b/src/modules/core.js @@ -604,10 +604,10 @@ /** * Modifies a page's content - * TODO the property name "contents" is quite silly, because people used to the MediaWiki API are gonna write "text" * + * @todo the property name "contents" is quite silly, because people used to the MediaWiki API are gonna write "text" * @param {string} pagename The page to be modified, namespace included - * @param {Object} options Object with properties: + * @param {Object} options Object with properties ('contents' is required, others are optional): * contents: {string} the text to add to/replace the page, * summary: {string} edit summary, will have the edit summary ad at the end, * createonly: {bool} set to true to only edit the page if it doesn't exist, @@ -615,6 +615,7 @@ * hide: {bool} Set to true to supress logging in statusWindow * statusText: {string} message to show in status; default: "Editing" * followRedirects: {boolean} true to follow redirects, false to ignore redirects + * watchlist: {string} 'nochange', 'preferences', 'unwatch', or 'watch' * @return {jQuery.Deferred} Resolves if saved with all data */ editPage: function ( pagename, options ) {