11

Description

This is a userscript partly inspired by Aran Fey's Duplicate Target Manager and responds to this meta question (by myself) API to programmatically close questions as duplicate with duplicate list. The skeleton of the code, CSS and HTML is an adaptation of SECloseVoteRequestGenerator.

Very common duplicates usually are closed against the same target, and with the same duplicate list. Since the above Meta.SE question is still a [feature-request], this script makes two calls to internal endpoints to:

  1. close a question as duplicate
  2. automatically edit the duplicate list with the other relevant Q&As.

The script allows to save and editing the duplicate targets (a.k.a. originals), so it effectively works as a duplicate manager too. (Editing features are currently limited).

How it works

The script adds a new action button under questions called "Hammer". By clicking on this button, a popup is shown with a dropdown. The dropdown items are the names of duplicate lists.

enter image description here

After selecting an item from the dropdown, the "Close" button becomes enabled. Pressing it will launch the two calls that respectively close the question and edit the full duplicate list in.

If the current question is already closed as duplicate, the "Close" button becomes "Edit links"; click it to launch only the second backend call.

Manage mode

By clicking "Manage", the popup expands to show some basic management of the duplicate lists. Select an item from the dropdown to manage a duplicate list. In manage mode, the "Close" button becomes disabled to avoid accidentally hammering questions.

enter image description here

Create new originals group

The "Add group" field allows you to create a new entry — i.e. a duplicate list — that is added to the dropdown. Input a name, then click "Add". The dropdown will reload with the new item.

Edit an existing originals group

When a dropdown item is selected, a list of all originals included in that group is displayed below the "Add group" input. Click "Add this question to selected targets" to add the question you are currently browsing to the duplicate list of the selected dropdown item.

If the current question is included in the selected group, the text of this button will change to "Remove this question from selected targets". Click on it to remove the original from the selected targets.

Click "Delete all" to remove the selected dropdown item. You cannot undo this action (but it will ask for confirmation first).

Basic validation

  • You cannot add more than 5 links to the same group
  • You cannot add the same question more than once.

Known limitations

  • The script doesn't check if you can hammer the question. You must use the script on questions where you have a gold tag badge. For other questions, the first call will simply cast a close vote (but not single-handedly hammer it) and the second call will fail.

Installation

Bugs, requests

You can post bugs or requests in the script repo.

0

You must log in to answer this question.

Browse other questions tagged .