-
Notifications
You must be signed in to change notification settings - Fork 176
speedy: add admin-only "Delete" and "Decline" buttons for quick parsing #2248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ff461bc to
7bd18b9
Compare
|
Small mistake, accidentally pushed the reload timer on this branch rather than on its own separate branch. Forced pushed it back, so it should be all good now. |
|
This is a fairly visible change for users, so I am soliciting user feedback at https://en.wikipedia.org/wiki/Wikipedia_talk:Twinkle#speedy%3A_add_admin-only_%22Delete%22_and_%22Decline%22_buttons_for_quick_parsing |
|
Opening CSD module on a nominated page already configures the dialog to delete based on the nomination. So "quick delete" is possible today with 3 clicks (TW > CSD > Delete). This patch introduces a 1-click way to do that. I'm skeptical of this being worth the added complexity. 3 clicks seems okay for deleting a page. How about just making the Delete button open the CSD dialog? That would make it 2 clicks and avoid most of the complexity. The "Decline" button seems more useful, as there is no good way to do it today (except through another user script which is old and probably unmaintained). |
| buttonContainer.appendChild(buttonNodes.decline); | ||
|
|
||
| const contestButton = document.querySelector( | ||
| 'table.ambox-speedy form[name="commentbox"].mw-inputbox-form-inline' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using such complex and fragile selectors, it's better to add a class or id to the button and target that
| @@ -24,7 +24,10 @@ Twinkle.speedy = function twinklespeedy() { | |||
| return; | |||
| } | |||
|
|
|||
| mw.loader.load('codex-styles'); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be loaded only if needed (inside createCodexButton).
| }; | ||
|
|
||
| Twinkle.speedy.instantDecline = function twinklespeedyInstantDecline() { | ||
| const wikipediaPage = new Morebits.wiki.Page(mw.config.get('wgPageName'), 'Tagging page'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Tagging page" is not what this does
| pageObj.setEditSummary('Declining speedy deletion (multiple criteria).'); | ||
| } | ||
| pageObj.setChangeTags(Twinkle.changeTags); | ||
| pageObj.save(window.location.reload.bind(window.location)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We normally show a completion success message and then reload after a couple of seconds. Also, let's not use .bind - the same could have been written as () => window.location.reload().
| } else { | ||
| pageObj.setEditSummary('Declining speedy deletion (multiple criteria).'); | ||
| } | ||
| pageObj.setChangeTags(Twinkle.changeTags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't handle watchlisting, which should be based on watchSpeedyPages pref, if not a new pref.
| if (Twinkle.speedy.normalizeHash[splitTag] === 'db') { | ||
| pageObj.setEditSummary('Declining speedy deletion (no code provided).'); | ||
| } else { | ||
| pageObj.setEditSummary('Declining speedy deletion ([[WP:CSD#' + Twinkle.speedy.normalizeHash[splitTag].toUpperCase() + '|CSD ' + Twinkle.speedy.normalizeHash[splitTag].toUpperCase() + ']]).'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit summary needs to include reason for declining. In other places we've done this using prompt().
|
|
||
| if (splitTag in Twinkle.speedy.normalizeHash) { | ||
| if (Twinkle.speedy.normalizeHash[splitTag] === 'db') { | ||
| pageObj.setEditSummary('Declining speedy deletion (no code provided).'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"(no code provided)" is unnecessary
| button.classList.add('cdx-button'); | ||
|
|
||
| // Action classes | ||
| if (action !== 'neutral') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can drop all these ifs.
If the "Delete" button is only one click instead of two clicks, I'd recommend renaming it to "Quick Delete". This is similar to what XFDcloser does with its "Close" and "Quick Close" buttons. We should decide if we want to only have a "Delete" button (2 clicks), only want to have a "Quick Delete" button (1 click), or have both. |
I would suggest having only "Delete". The "Decline" button currently is really a "Quick Decline", but once a |
|
Working on all the changes. Regarding "Delete" vs "Quick Delete", I don't see the point in making it two clicks instead of one. It makes sense for "Decline" since you'd want to input a reason, but "Delete" fundamentally means you agree with the speedy deletion tag, and adding an extra click would just make it more cumbersome (and defeat the original purpose of a shortcut button). |
|
I think deleting a page is a serious thing and personally would prefer a 2-click process. XfdCloser has these quick actions but at least its interface makes it clear that the buttons are from a gadget. Here, the buttons look like a part of the template itself. I can't think of any other buttons on templates that cause an immediate write action (eg. the "create page" buttons from |
…oad because callbacks.sysop.main doesn't)
7bd18b9 to
f60462b
Compare
Technically, there is already a delete button, but it is nearly invisible, doesn't delete talk pages and redirects, doesn't log, and only takes you to the (non-Twinkle) deletion interface. This is a much quicker and more visible delete button, plus an option to decline (removing the db template). Tested here.