Anyone know how to stop this glitch (like a post more than once)?

There’s a glitch where a user can like a post more than once if he/she clicks the upvote button multiple times very quickly. Any one got an idea how to prevent this?

Picking up from a post made by fayewatson

Continuing the discussion from Make button clickable only once [Solved]:

here’s the preview. try it out. click the upvote button repeatedly and quickly. I’m trying to prevent multiple upvotes by one user.

Preview: https://faye-demo-app.bubbleapps.io/version-test/upvote
here’s the workflow: https://bubble.io/page?type=page&name=upvote&id=faye-demo-app&tab=tabs-2

Hi @cdorozco16 :slight_smile: Great find! I cloned that first demo and updated it so that the upvote icon can only be clicked once:

Preview:

Editor:

In this example, there is a custom state on the Ionic Icon Arrow Up element called “Upvoted?” (type: yes/no, list: no). (This custom state value helps us keep track of whether the Current User has already clicked to like a particular Topic).

When the Current User hasn’t yet liked a Topic, and clicks to upvote that Topic, the third action in the new Upvote workflow sets this cell’s Ionic Icon Arrow Upvote elment’s “Upvoted?” custom state value to “yes”.

To make sure the Current User can’t click to Upvote quickly again, the create a new Like workflow event’s “only when” condition now states that the workflow can only be run when the “Upvoted?” custom state value is “no”. (So if the Current User just clicked to Upvote a Topic, that custom state value would be “yes”, preventing the create a new Like workflow from running again if the User clicks quickly.)
2019-02-08_19-05-39

Alternatively, the workflow which deletes a “Like” has an action which sets the “Upvoted?” custom state value back to “no”.

This makes sure that the Current User can click to upvote that Topic again, since that cell’s Ionic Icon Arrow Upvote element’s “Upvoted?” custom state is “no”.

You could also store a list of Users who Upvote a particular Topic on the Topic itself.
That would also definitely make sure that the Upvote could only be clicked once, since the same User can’t appear in the same list more than once. This should work, but feel free to let me know if you have any questions! :slight_smile:

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.