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

I am seeing the same issue with duplicated comments as in Bug? Duplicated comment (unresolved), in but I have some more information which might help to recreate the bug.

There was a comment which I was going to flag as offensive, unfortunately I accidentally clicked upvote and then I didn't seem able to flag it again after that. I went 'back' on the browser and flagged it. Then there appeared a duplicate comment, both of which I appear to have upvoted, but only appearing when I'm signed in. When I log out it's gone, and when I log in again it's back.



By the way, it was slightly annoying to have cast a vote like 'this is a great comment' when I was actually intending to say this is an offensive comment. Could it be possible to undo comment upvotes, like you can with Q and A posts, or at least not remove the vote to flag?

share|improve this question
Changing wrong votes on comments is one of the most upvoted status-declined feature-requests that are out there. Please throw another vote on the fire. – Lance Roberts Aug 25 '11 at 7:15
@Lance: I gave it an upvote. I have often wanted to quickly retract a comment vote immediately after clicking the arrow - but alas, not currently possible. – uɐɯsO uɐɥʇɐN Aug 25 '11 at 7:21
Totally reproduced; thanks for the steps. Looking at it. – balpha Aug 25 '11 at 7:47
up vote 8 down vote accepted

There were two issues at play here:

  1. The server didn't enforce the "either flag or upvote, not both" rule. While the UI enforces this, there are obivously ways around it – like the one you found.
  2. The code that fetches the comments relied on the fact that the user has only voted (i.e. upvoted or flagged) once. While that's a reasonable assumption, there are edge cases where this may not be true (two I can think off: the one you found, and a connection hickup between the DB server and the web server – the latter is likely what happened in the other case).

Part 1 is fixed by enforcing the rule on the server as well.

Part 2 is fixed by considering this edge case and picking up each comment only once, even if a duplicate vote/flag somehow made it through. As I said, that's very unlikely, but since we cannot enforce this, say, through a UNIQUEness constraint in the database (due to the way the data is stored), it's not impossible. For perspective: Out of close to 9 million comments on Stack Overflow, yours was the fourth where this happened.

(Fix will go out with the next build.)

share|improve this answer
impressive turnaround ! – wim Aug 26 '11 at 5:32

You must log in to answer this question.

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