Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

If you have the priviledge to delete answers with negative score, a delete button is shown in the flag queue:

Flag queue delete button

But if the answer did not have a negative score before and I downvoted it then there is no delete button:

Flag queue no delete button

I would have to refresh the page to see the delete button. But then I loose the focus on that post or it may not even be in the current list any more and I would have to search it.

Can this button be added on-the-fly when I downvote?

share|improve this question

closed as off-topic by Ilmari Karonen, animuson, Martijn Pieters, mhlester, ɥʇǝS Jun 5 '14 at 22:43

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "The problem described here can no longer be reproduced. Changes to the system or to the circumstances affecting the asker have rendered it obsolete. If you encounter a similar problem, please post a new question." – Ilmari Karonen, animuson, Martijn Pieters, mhlester, ɥʇǝS
If this question can be reworded to fit the rules in the help center, please edit the question.

Click share, Ctrl+C, Alt+D, Ctrl+V, enter > F5 (not that I'd mind your proposal, if there's time to spare for implementing it...) – Nick Stauner Mar 8 '14 at 9:38
+1 - also, I'd like a combined "downvote, close, delete-when-closed" batch button on questions :-) – Kerrek SB Mar 8 '14 at 11:56

I've added a client-side implementation of this feature into the Stack Overflow Unofficial Patch v1.10.

In case you're curious, here's the JavaScript code that does it:

if ( ! $('').length ) return;
if ( SOUP.userRep < ( SOUP.isBeta ? 4000 : 20000 ) ) return;

var html = '<input title="vote to delete this answer" class="delete-post" value="delete answer" type="button">';

SOUP.hookAjax( /^\/posts\/\d+\/vote\/[023]\b/, function ( event, xhr, settings ) {
    var score = $.parseJSON( xhr.responseText ).NewScore;
    var pid = Number( settings.url.replace( /^\/posts\/(\d+)\/.*/, '$1' ) );

    // if it's not an answer, do nothing
    if ( ! $('#flagged-' + pid + ' #answer-' + pid).length ) return;

    // find *all* the delete buttons/links; there may be several!
    var button = $('[id="delete-post-' + pid + '"]');

    if ( score >= 0 ) button.hide();
    else if ( button.length );
    else $(html).attr('id', 'delete-post-' + pid).insertAfter('#flagged-' + pid + ' .flag-post-button').before(' ');
} );

The SOUP.hookAjax() function is a small piece of utility code that monitors the jQuery AJAX requests used to submit post up/downvotes. If an answer is upvoted (or un-downvoted) to a positive score from the review view, the event handler above hides the delete button; if it's downvoted to a score of zero or less, it re-shows it, or, if necessary, injects its own "fake" (but fully functional!) delete button.

(For an official fix, it would probably be easier to just include the delete buttons in the HTML for all answers, but hide it by default for those with a positive score. I can't do that in a user script, so I have to hardcode the button HTML into the script.)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .