From 0fe7740a41866649b5d0f28fbb3a0cd377e1e046 Mon Sep 17 00:00:00 2001 From: kikito Date: Fri, 21 Aug 2015 20:36:04 +0200 Subject: [PATCH] Refactors ability making flagging more efficient --- app/models/ability.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index 1c849ae42..6093a373b 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -17,19 +17,19 @@ class Ability can :create, Debate can :flag_as_inappropiate, Comment do |comment| - comment.author != user && !InappropiateFlag.flagged?(user, comment) + comment.author_id != user.id && !InappropiateFlag.flagged?(user, comment) end can :undo_flag_as_inappropiate, Comment do |comment| - comment.author != user && InappropiateFlag.flagged?(user, comment) + comment.author_id != user.id && InappropiateFlag.flagged?(user, comment) end can :flag_as_inappropiate, Debate do |debate| - debate.author != user && !InappropiateFlag.flagged?(user, debate) + debate.author_id != user.id && !InappropiateFlag.flagged?(user, debate) end can :undo_flag_as_inappropiate, Debate do |debate| - debate.author != user && InappropiateFlag.flagged?(user, debate) + debate.author_id != user.id && InappropiateFlag.flagged?(user, debate) end unless user.organization?