FEATURE: Implement SiteSetting to Allow Anonymous Likes (#22131)

Allow anonymous users (logged-in, but set to anonymous posting) to like posts

---------

Co-authored-by: Emmett Ling <eling@zendesk.com>
Co-authored-by: Nat <natalie.tay@discourse.org>
This commit is contained in:
Emmett Ling
2023-07-21 06:21:07 -07:00
committed by GitHub
parent 8ffc274438
commit 978d52841a
7 changed files with 221 additions and 4 deletions

View File

@@ -315,8 +315,14 @@ class PostSerializer < BasicPostSerializer
summary.delete(:can_act)
end
if actions.present? && SiteSetting.allow_anonymous_likes && sym == :like &&
!scope.can_delete_post_action?(actions[id])
summary.delete(:can_act)
end
if actions.present? && actions.has_key?(id)
summary[:acted] = true
summary[:can_undo] = true if scope.can_delete?(actions[id])
end