summaryrefslogtreecommitdiff
path: root/app/models/ci/pipeline_schedule.rb
diff options
context:
space:
mode:
authorKamil TrzciƄski <ayufan@ayufan.eu>2017-05-29 20:46:56 +0000
committerTimothy Andrew <mail@timothyandrew.net>2017-06-13 06:23:16 +0000
commit16977ad3f37250dfb26a835e391688123966ec3b (patch)
treeadc567ab48a34f5a81df4003fbda9e8ba0087f06 /app/models/ci/pipeline_schedule.rb
parentcd40278beeec41f900f53d1c2df6be944b018647 (diff)
downloadgitlab-ce-16977ad3f37250dfb26a835e391688123966ec3b.tar.gz
Merge branch '32790-pipeline_schedules-pages-throwing-error-500' into 'master'
Resolve "pipeline_schedules pages throwing error 500" Closes #32790 See merge request !11706 Conflicts: app/models/ci/pipeline_schedule.rb app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml
Diffstat (limited to 'app/models/ci/pipeline_schedule.rb')
-rw-r--r--app/models/ci/pipeline_schedule.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/models/ci/pipeline_schedule.rb b/app/models/ci/pipeline_schedule.rb
index 6d7cc83971e..ac159074c07 100644
--- a/app/models/ci/pipeline_schedule.rb
+++ b/app/models/ci/pipeline_schedule.rb
@@ -10,9 +10,9 @@ module Ci
has_one :last_pipeline, -> { order(id: :desc) }, class_name: 'Ci::Pipeline'
has_many :pipelines
- validates :cron, unless: :importing_or_inactive?, cron: true, presence: { unless: :importing_or_inactive? }
- validates :cron_timezone, cron_timezone: true, presence: { unless: :importing_or_inactive? }
- validates :ref, presence: { unless: :importing_or_inactive? }
+ validates :cron, unless: :importing?, cron: true, presence: { unless: :importing? }
+ validates :cron_timezone, cron_timezone: true, presence: { unless: :importing? }
+ validates :ref, presence: { unless: :importing? }
validates :description, presence: true
before_save :set_next_run_at
@@ -28,8 +28,17 @@ module Ci
!active?
end
+<<<<<<< HEAD
def importing_or_inactive?
importing? || inactive?
+=======
+ def deactivate!
+ update_attribute(:active, false)
+ end
+
+ def runnable_by_owner?
+ Ability.allowed?(owner, :create_pipeline, project)
+>>>>>>> 9dfecec... Merge branch '32790-pipeline_schedules-pages-throwing-error-500' into 'master'
end
def set_next_run_at