From 25b037a2684f25e5ddd47e349c6820a5fca60235 Mon Sep 17 00:00:00 2001 From: Peter Hankiewicz Date: Fri, 25 Feb 2022 19:57:26 +0100 Subject: [PATCH] Allow admins to create media mentions --- app/models/ability.rb | 1 + spec/models/ability_spec.rb | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/app/models/ability.rb b/app/models/ability.rb index 3bd4ad063..9cfd20bd6 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -57,6 +57,7 @@ def initialize(user) can :create, Work can :create, Entity can :create, EntityNoticeRole + can :create, MediaMention can :pdf_requests, :all can :view_full_version, Notice diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index 5a63aeea9..72f7184c3 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -166,6 +166,12 @@ expect(subject.can? :edit, user).to be_falsey expect(subject.can? :edit, role).to be_falsey end + + it "can create media mentions" do + %i[create read update].each do |action| + expect(subject.can? action, MediaMention.new).to be true + end + end end context "a super admin" do