FEATURE: New DiscourseEvent trigger for likes (#12374)

This commit is contained in:
Rafael dos Santos Silva 2021-03-11 21:07:29 -03:00 committed by GitHub
parent 9aa510f609
commit 9737ce8c5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -265,8 +265,13 @@ private
end end
end end
if post_action && PostActionType.notify_flag_type_ids.include?(@post_action_type_id) if post_action
DiscourseEvent.trigger(:flag_created, post_action) case @post_action_type_id
when *PostActionType.notify_flag_type_ids
DiscourseEvent.trigger(:flag_created, post_action)
when PostActionType.types[:like]
DiscourseEvent.trigger(:like_created, post_action)
end
end end
GivenDailyLike.increment_for(@created_by.id) if @post_action_type_id == PostActionType.types[:like] GivenDailyLike.increment_for(@created_by.id) if @post_action_type_id == PostActionType.types[:like]