Skip to content
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

Prevent users from adding multiple votes on a single bug #13

Merged

Conversation

jacobbednarz
Copy link
Contributor

Fixes #51535 by implementing a single bug ID and IP check prior to inserting a users vote.

@bjori
Copy link
Member

bjori commented Dec 31, 2014

Shouldn't it rather overwrite the previous vote?
Otherwise we'll get mail that they accidentally voted x but wanted to vote y?

This isn't particularly high impact feature though, its mostly to avoid users commenting "me too"

@jacobbednarz
Copy link
Contributor Author

Shouldn't it rather overwrite the previous vote?
Otherwise we'll get mail that they accidentally voted x but wanted to vote y?

It hadn't thought of that - humans are clumsy and I could see this being an issue. I'm happy to have it update the record if you feel that it would better close this bug report off?

Instead of ignoring duplicate votes this allows the votes to be updated which
will allow users to update if they vote incorrectly initially.
@jacobbednarz
Copy link
Contributor Author

Updated to allow duplicate votes to update instead of ignoring.

@bjori
Copy link
Member

bjori commented Jan 5, 2015

Is there no "UPDATE .... ON NOT EXISTS INSERT INTO ..." (upsert) mechanism in MySQL?
Its weird you need to query/count first and then decide to update a record or insert it.

If not, then this is fine with me

@php-pulls
Copy link

There is: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
Not sure about our unique indexes.
2015.01.05. 19:19 ezt írta ("Hannes Magnusson" notifications@github.com):

Is there no "UPDATE .... ON NOT EXISTS INSERT INTO ..." (upsert) mechanism
in MySQL?
Its weird you need to query/count first and then decide to update a record
or insert it.

If not, then this is fine with me


Reply to this email directly or view it on GitHub
#13 (comment).

@bjori
Copy link
Member

bjori commented Jan 5, 2015

Right, thats the other way around -
INSERT or UPDATE if it did exists. We want
UPDATE if it exists or INSERT if it does not

we cannot add unique index on this at this point as I'm sure there are plenty dupes already.

@bjori
Copy link
Member

bjori commented Jan 5, 2015

you have karma to merge it yourself now

@php-pulls php-pulls merged commit 218cb88 into php:master Jan 6, 2015
@jacobbednarz jacobbednarz deleted the prevent-multiple-votes-on-single-bug branch January 6, 2015 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants