diff --git a/app/models/ability.rb b/app/models/ability.rb index 40a8f5f69..23c6f9f01 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -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? diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index 064bb6335..a2e6212b5 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -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) }