diff options
author | Stan Hu <stanhu@gmail.com> | 2017-12-06 10:36:49 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-13 02:07:24 +0300 |
commit | 87118872c94ab465d400090e247b1e4ae90c2d82 (patch) | |
tree | e1139ab70d1acdcd66e202421d404b68bf731d70 | |
parent | bc2d32aca0be46250bd02c9312d1064df024b621 (diff) |
Fix conditions for checking pipeline schedule rules
-rw-r--r-- | app/policies/ci/pipeline_schedule_policy.rb | 6 | ||||
-rw-r--r-- | app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/app/policies/ci/pipeline_schedule_policy.rb b/app/policies/ci/pipeline_schedule_policy.rb index 8e7e129f135..c0a2bb963e9 100644 --- a/app/policies/ci/pipeline_schedule_policy.rb +++ b/app/policies/ci/pipeline_schedule_policy.rb @@ -6,11 +6,11 @@ module Ci access = ::Gitlab::UserAccess.new(@user, project: @subject.project) if @subject.project.repository.branch_exists?(@subject.ref) - access.can_update_branch?(@subject.ref) + !access.can_update_branch?(@subject.ref) elsif @subject.project.repository.tag_exists?(@subject.ref) - access.can_create_tag?(@subject.ref) + !access.can_create_tag?(@subject.ref) else - true + false end end diff --git a/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml b/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml index 12d7e81c39e..f8c4005a9e0 100644 --- a/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml +++ b/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml @@ -27,7 +27,7 @@ %td .pull-right.btn-group - if can?(current_user, :play_pipeline_schedule, pipeline_schedule) - = link_to run_pipeline_schedule_path(pipeline_schedule), method: :post, title: s_('Play'), class: 'btn' do + = link_to play_pipeline_schedule_path(pipeline_schedule), method: :post, title: s_('Play'), class: 'btn' do = icon('play') - if can?(current_user, :update_pipeline_schedule, pipeline_schedule) = link_to take_ownership_pipeline_schedule_path(pipeline_schedule), method: :post, title: s_('PipelineSchedules|Take ownership'), class: 'btn' do |