Do not show play action if user not allowed to run it
This commit is contained in:
parent
3dbef510c1
commit
5b6202cce1
2 changed files with 11 additions and 3 deletions
|
@ -10,7 +10,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def has_action?
|
||||
can?(user, :update_build, subject)
|
||||
can?(user, :update_build, subject) && subject.can_play?(user)
|
||||
end
|
||||
|
||||
def action_icon
|
||||
|
|
|
@ -17,11 +17,19 @@ describe Gitlab::Ci::Status::Build::Play do
|
|||
|
||||
describe '#has_action?' do
|
||||
context 'when user is allowed to update build' do
|
||||
before { build.project.team << [user, :developer] }
|
||||
context 'when user can push to branch' do
|
||||
before { build.project.add_master(user) }
|
||||
|
||||
it { is_expected.to have_action }
|
||||
end
|
||||
|
||||
context 'when user can not push to the branch' do
|
||||
before { build.project.add_developer(user) }
|
||||
|
||||
it { is_expected.not_to have_action }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user is not allowed to update build' do
|
||||
it { is_expected.not_to have_action }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue