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
FEATURE: Implement SiteSetting to Allow Anonymous Likes #22131
FEATURE: Implement SiteSetting to Allow Anonymous Likes #22131
Conversation
9487b80
to
c977fea
Compare
c977fea
to
6573bc0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few spec comments but 👍
This pull request has been mentioned on Discourse Meta. There might be relevant details there: https://meta.discourse.org/t/pull-request-sitesetting-to-anonymous-users-to-like-posts/268660/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @meltingmettle, the PR looks good. I am curious, what does the like popup look like in this scenario? I would expect it to be a list of anonymized user avatars. Is that correct?
Approving, will look into merging it shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are some UX issues here:
We still need to comply to post_undo_action_window_mins
, which isn't happening. Ideally after X mins, the anonymous user should see this.
The current bug now is that when the anon user clicks on the red ❤️ to undo the like, the frontend shows that the "like" is removed, but when you refresh the page it is actually still liked.
return( | ||
SiteSetting.allow_anonymous_likes? && obj.class == PostAction && obj.is_like? && | ||
obj.user_id == @user.id | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax_tree really wanted this format. :/
Originally this looked like:
return SiteSetting.allow_anonymous_likes? && obj.class == PostAction && obj.is_like? && obj.user_id == @user.id if anonymous?
Hey there @meltingmettle, the issue hasn't been addressed. This is what I am seeing now with the newest commit. Screen.Recording.2023-07-13.at.12.40.23.AM.movThis is what needs to be shown: Screen.Recording.2023-07-13.at.12.42.59.AM.movWe need to abide by You can follow these steps:
|
Hi @nattsw, thank you for the second review. I'm having a bit of trouble figuring out where the disallow is supposed to happen since However, despite this method returning false correctly after the window has closed, the disallow symbol does not appear, but there is no other method that references Could you please point me towards the block of code that calls the disallow symbol? Thank you! |
This pull request has been mentioned on Discourse Meta. There might be relevant details there: https://meta.discourse.org/t/pull-request-sitesetting-to-anonymous-users-to-like-posts/268660/11 |
I traced the attribute from the css class: discourse/app/assets/javascripts/discourse/app/widgets/post-menu.js Lines 166 to 181 in a982b67
then
then
then, I suspect the problem is with this line: discourse/app/serializers/post_serializer.rb Lines 299 to 308 in e214fc3
In the case where the user is not anon, the "can_act" value is not present. Conversely, when the user is anon, "can_act" is present. There's probably an issue here with the scope. Can you take a stab at figuring this one? |
…ion_window_mins has passed
9416b6a
to
8a31e8e
Compare
Thank you for the tip! That was super helpful! I’ve pushed a patch, manually verified the behavior, and added additional test coverage. It’s ready for another round of review when you have the chance. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woohoo!
🚀
Will merge this once tests are passing
EDIT: Merged main
due to failing spec due to webdriver update.
This pull request adds a SiteSetting to allow admins to enable or disable anonymous liking.
Changes:
allow_anonymous_likes
SiteSettingis_my_own?
to recognize "like" post actions for anonymous users, since this behavior is required in order to allow anonymous users to remove their likes.:can_act
scope from anonymous users afterpost_undo_action_window_mins
has closed.