Skip to content

Commit

Permalink
PERF: don't count all likes twice on like
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Jun 25, 2015
1 parent 8252f4e commit 1edb591
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/models/post_action.rb
Expand Up @@ -280,9 +280,12 @@ def self.act(user, post, post_action_type_id, opts = {})
end

# agree with other flags
PostAction.agree_flags!(post, user) if staff_took_action
# update counters
post_action.try(:update_counters)
if staff_took_action
PostAction.agree_flags!(post, user)

# update counters
post_action.try(:update_counters)
end

post_action
rescue ActiveRecord::RecordNotUnique
Expand Down

0 comments on commit 1edb591

Please sign in to comment.