Find a comment on any page on the PL website and you will find that clicking its like button results in a POST request to show a 'noty notification' (a green popup to the right saying 'Reacted'! or 'Unreacted!') and does not send any request to actually "like" the comment or update the comment's like button UI to show it has been liked:
Here is an example page:
https://publiclab.org/questions/OrionAllgaier/03-13-2019/questions-from-the-university-of-wisconsin-eau-claire
The code needs to be added to implement the like functionality for a comment. Please reference the PR #4852 to find some files that may be useful to you in implementing this and to note some bugs we experienced while adding like functionality elsewhere and how it was solved.
Thank you!!
@jywarren Do you think this is descriptive enough for someone to take on this issue with everything in mind from the last one I did or can I improve it?
I think this is good, although maybe a link to the Js code driving the
button would be nice to add! Thanks!
On Sat, Mar 16, 2019, 5:01 PM Sasha Boginsky notifications@github.com
wrote:
@jywarren https://github.com/jywarren Do you think this is descriptive
enough for someone to take on this issue with everything in mind from the
last one I did or can I improve it?โ
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/5113#issuecomment-473592455,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABfJ9GwXB5Tt8GI1pH03sQFSa4yPoUUks5vXVt-gaJpZM4b4BtJ
.
@sashadev-sky @jywarren Is this issue available. ?
@CleverFool77 hey it is! All yours! You have enough information to get started but Iโll post some more things that might help you shortly
(This was specifically for liking notes)
javascript driving the like button functionality: https://github.com/publiclab/plots2/blob/master/app/assets/javascripts/like.js
So now there is both but implement it however you would like! I definitely think my code could be improved on if you have any ideas for the implementation for comments.
@sashadev-sky I am looking forward to work on this issue. What if we just increase the size of icons representing the expressions the current user has already reacted? We might need some extra data from back-end as well, I am not sure if the back-end is already checking whether current user has reacted to a given comment.
Just adding some context here, i believe the reactions system was built over the previous comment liking system, and we had hoped that the ๐ reaction would replace "liking" -- in fact, i think i recall that previously made "likes" were converted to ๐ retroactively!
I wonder also if the interface "like" buttons @sashadev-sky had seen are now gone too?
Does that mean that this issues is mostly complete? Is there more we could do to clarify that ๐ == 'like'?
@jywarren Doing some research on this.
The code in like.js seems to apply to liking research notes (not liking comments on research notes).
For example this function here does some eventHandling on #like-button-1234
https://github.com/publiclab/plots2/blob/38e37eb20602d799ab935e4e281f32782e856fda/app/assets/javascripts/like.js#L14-L25
Which is an ID that appears here:
https://github.com/publiclab/plots2/blob/38e37eb20602d799ab935e4e281f32782e856fda/app/views/like/_like.html.erb#L26-L34
That corresponds to this star button below, which is for liking a research note in general:

Current Video of Liking Notes in Action:
https://user-images.githubusercontent.com/4361605/105620297-49e05d00-5db0-11eb-9d82-c8a3690804f7.mov
Find a comment on any page on the PL website and you will find that clicking its like button results in a POST request to show a 'noty notification' (a green popup to the right saying 'Reacted'! or 'Unreacted!') and does not send any request to actually "like" the comment or update the comment's like button UI to show it has been liked
Current Status of Liking Notes:
The code needs to be added to implement the like functionality for a comment. Please reference the PR #4852 to find some files that may be useful to you in implementing this and to note some bugs we experienced while adding like functionality elsewhere and how it was solved.
It seems like this PR #4852 was merged right around the time this issue was created. It seems like that PR actually solves this issue? Not sure what is left over, I'd have to sift through that issue to see.
Just browsed #4852, it seems like that PR was fixing a problem with likes via debouncing (liking a note was triggering a million likes and dislikes, GIF here in this note)
I think this issue can be closed... It really seems like the problem's been solved since it was created? Liking notes AND liking comments work as expected, they send POST requests to the server, the models are updated etc.
The only thing that is missing in both cases which would be nice is a Noty Notification appearing for 'Note Liked!' and 'Comment Liked!' I can make an issue in both cases.
@jywarren Last note, in reference to this comment:
Just adding some context here, i believe the reactions system was built over the previous comment liking system, and we had hoped that the ๐ reaction would replace "liking" -- in fact, i think i recall that previously made "likes" were converted to ๐ retroactively!
I think that was done in 2018 in this PR #2869, so that was already in place by the time this issue was made.
Can you review and close this issue if you think that's appropriate?
I just did a little more browsing to make absolutely certain that things are working like they should be. I still think they are! Just leaving a trail here so that others can follow.
Clicking on the star button to like a note calls the following (event attached to #like-button-1234):
https://github.com/publiclab/plots2/blob/38e37eb20602d799ab935e4e281f32782e856fda/app/views/like/_like.html.erb#L221
clickliked is defined here in like.js:
https://github.com/publiclab/plots2/blob/38e37eb20602d799ab935e4e281f32782e856fda/app/assets/javascripts/like.js#L4-L7
changeLikeStatus is what actually sends a request to the server:
https://github.com/publiclab/plots2/blob/38e37eb20602d799ab935e4e281f32782e856fda/app/assets/javascripts/like.js#L14-L25
The route `/likes/node/123/create' is defined here:
https://github.com/publiclab/plots2/blob/38e37eb20602d799ab935e4e281f32782e856fda/app/controllers/like_controller.rb#L29-L31
Node.like is defined here:
https://github.com/publiclab/plots2/blob/38e37eb20602d799ab935e4e281f32782e856fda/app/models/node.rb#L1093-L1125
The DB is updated here to show that user liked the node:
https://github.com/publiclab/plots2/blob/38e37eb20602d799ab935e4e281f32782e856fda/app/models/node.rb#L1079-L1091
@jywarren (or anyone else that can review this), can you double-check the above to see that all the parts are working as expected? I think they are, AFAIK.
If everything looks okay, I recommend we close this issue, and open a new one: _"Display Notification When User Likes Research Note"_
This all looks right, and esp the part about:
I think that was done in 2018 in this PR #2869, so that was already in place by the time this issue was made.
as that is specific to liking individual comments, not just notes. Sounds good to me and THANK YOU SO MUCH for digging through this so thoroughly!!!
Most helpful comment
@CleverFool77 hey it is! All yours! You have enough information to get started but Iโll post some more things that might help you shortly