Like/Dislike button - how to Dislike?

I have a “Thumbs up” like button. When a User clicks it, the Workflow adds +1 to the number of Likes to the Current Cell’s item, and adds the current User to the list of users who have Liked the item. Restriction is Only When current User is not already in the List of Users who have liked the item, so you can’t Like something more than once.

Additionally, I have a Conditional on the Icon, so that when the List of Users who like the content includes the current user, then the Icon changes to a solid Icon from outline only, so a User can see if they have liked something themselves alreadz.

So basically a User can like an item once and the Thumbs Up icon changes from outline to filled.

I can’t work out how to make someone able to Unlike the same item.

I tried to make the Workflow so that in the same workflow for clicking the icon, if the User is in the List of Users that liked the item, then the Number of Likes is -1 and that User is removed from List of Users that liked the item. And then the icon should go from Filled to Outline only based on the conditional.

However, that kinda means that the Workflow is maybe trying to Add and Remove the User at the same time, which is maybe why it doesn’t work?

Can anyone suggest anything? The only article I found about this showed how to add Likes, but skipped how to un-like something. I guess if the Icon changes when it is clicked, you should start the Workflow on the replacement Icon, but I can’t see how to do that as it is in the Conditional. Even if I remove the Conditional I can’t Like/Unlike.

Not sure of your setting. But I guess you have a list of user that like and a list of user that dislike.
Basically, you don’t need to do +1 or -1. The list of user that like:count and same for discount should do the job.
Your workflow should be
User click like: Update thing, Like field add current user, Dislike fied remove current user
User click dislike, Update thing, Like field remove current user, Dislike field add current user.

And your condition on each icon should be like: User that like list contain current user (or dislike list contain current user)

3 Likes

Hey @major_groove,

I have an old app that might be able to help you out. Here’s a link to the editor and preview:

Editor:

Preview:

Hope this helps.

-Brandon

2 Likes

Sorry. I post a solution if you have two button (thumbs up and thumbs down for example)
But if you have one, Look at the demo @lantzgould and this is how you can do it :wink: (heart)

2 Likes

That was it! Thanks! :heart_eyes:

OK, my problem was that I did not realise I could duplicate a workflow on an element (only way I can see to do it is to copy and paste the Workflow) and I didn’t realise I could set a Conditional for the entire Workflow itself.

/newbie excuses! :relaxed:

2 Likes

@major_groove Awesome! Glad it helped. :slight_smile:

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