Adds new abilities for proposals
This commit is contained in:
@@ -71,8 +71,14 @@ class Ability
|
||||
can :ignore_flag, Proposal, ignored_flag_at: nil, hidden_at: nil
|
||||
cannot :ignore_flag, Proposal, author_id: user.id
|
||||
|
||||
can :moderate, Proposal
|
||||
cannot :moderate, Proposal, author_id: user.id
|
||||
|
||||
can :hide, User
|
||||
cannot :hide, User, id: user.id
|
||||
|
||||
can :block, User
|
||||
cannot :block, User, id: user.id
|
||||
end
|
||||
|
||||
if user.moderator?
|
||||
|
||||
@@ -198,9 +198,15 @@ describe Ability do
|
||||
it { should_not be_able_to(:ignore_flag, ignored_proposal) }
|
||||
it { should_not be_able_to(:ignore_flag, own_proposal) }
|
||||
|
||||
it { should be_able_to(:moderate, proposal) }
|
||||
it { should_not be_able_to(:moderate, own_proposal) }
|
||||
|
||||
it { should_not be_able_to(:hide, user) }
|
||||
it { should be_able_to(:hide, other_user) }
|
||||
|
||||
it { should_not be_able_to(:block, user) }
|
||||
it { should be_able_to(:block, other_user) }
|
||||
|
||||
it { should_not be_able_to(:restore, comment) }
|
||||
it { should_not be_able_to(:restore, debate) }
|
||||
it { should_not be_able_to(:restore, proposal) }
|
||||
|
||||
Reference in New Issue
Block a user