summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-26 18:00:42 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-29 20:02:09 +0900
commit5d8ee3ed1cde777adc2e9717bc030b9481fb81c4 (patch)
tree013dea280fe96ccbff15e7a0f07bc120254171fa
parent602d09ffe8b3a03441f33a140d949b2725699fb9 (diff)
downloadgitlab-ce-5d8ee3ed1cde777adc2e9717bc030b9481fb81c4.tar.gz
Validate parameters when active is false
-rw-r--r--app/models/ci/pipeline_schedule.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/app/models/ci/pipeline_schedule.rb b/app/models/ci/pipeline_schedule.rb
index cf6e53c4ca4..07213ca608a 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
@@ -32,10 +32,6 @@ module Ci
update_attribute(:active, false)
end
- def importing_or_inactive?
- importing? || inactive?
- end
-
def runnable_by_owner?
Ability.allowed?(owner, :create_pipeline, project)
end