Move disable recommendations permissions to Abilities::Common model

This commit is contained in:
Angel Perez
2018-07-13 08:18:58 -04:00
parent 54853745f0
commit 31c16406c0
3 changed files with 8 additions and 1 deletions

View File

@@ -94,6 +94,8 @@ module Abilities
can [:create], Topic can [:create], Topic
can [:update, :destroy], Topic, author_id: user.id can [:update, :destroy], Topic, author_id: user.id
can :disable_recommendations, [Debate, Proposal]
end end
end end
end end

View File

@@ -29,7 +29,6 @@ module Abilities
can [:read], Legislation::Question can [:read], Legislation::Question
can [:read, :map, :share], Legislation::Proposal can [:read, :map, :share], Legislation::Proposal
can [:search, :comments, :read, :create, :new_comment], Legislation::Annotation can [:search, :comments, :read, :create, :new_comment], Legislation::Annotation
can :disable_recommendations, [Debate, Proposal]
end end
end end
end end

View File

@@ -299,4 +299,10 @@ describe Abilities::Common do
it { should_not be_able_to(:answer, incoming_poll_question_from_other_geozone) } it { should_not be_able_to(:answer, incoming_poll_question_from_other_geozone) }
end end
end end
describe "#disable_recommendations" do
it { should be_able_to(:disable_recommendations, Debate) }
it { should be_able_to(:disable_recommendations, Proposal) }
end
end end