FIX: Do not create a double like notification. (#7999)

When a user liked, unliked and liked again the same post, the poster
would receive a notification such as "X and X liked ...". This happened
because PostActionNotifier.post_action_created was called twice.
This commit is contained in:
Dan Ungureanu
2019-08-12 16:22:46 +03:00
committed by GitHub
parent 1a8fee11a0
commit 2a98becfde
2 changed files with 14 additions and 1 deletions

View File

@ -205,7 +205,6 @@ private
post_action.recover!
action_attrs.each { |attr, val| post_action.public_send("#{attr}=", val) }
post_action.save
PostActionNotifier.post_action_created(post_action)
else
post_action = PostAction.create(where_attrs.merge(action_attrs))
if post_action && post_action.errors.count == 0