diff --git a/app/controllers/projects/settings/ci_cd_controller.rb b/app/controllers/projects/settings/ci_cd_controller.rb index 0ae4b4d3945..6f009d61950 100644 --- a/app/controllers/projects/settings/ci_cd_controller.rb +++ b/app/controllers/projects/settings/ci_cd_controller.rb @@ -27,7 +27,6 @@ module Projects def define_triggers_variables @triggers = @project.triggers @trigger = Ci::Trigger.new - @trigger.build_trigger_schedule end def define_badges_variables diff --git a/app/controllers/projects/triggers_controller.rb b/app/controllers/projects/triggers_controller.rb index 2a3c563890b..4f5d336ce40 100644 --- a/app/controllers/projects/triggers_controller.rb +++ b/app/controllers/projects/triggers_controller.rb @@ -34,7 +34,6 @@ class Projects::TriggersController < Projects::ApplicationController end def edit - @trigger.build_trigger_schedule unless @trigger.trigger_schedule.present? end def update diff --git a/app/models/ci/trigger.rb b/app/models/ci/trigger.rb index f7ceba0d2a5..3358f901542 100644 --- a/app/models/ci/trigger.rb +++ b/app/models/ci/trigger.rb @@ -39,5 +39,9 @@ module Ci def can_access_project? self.owner_id.blank? || Ability.allowed?(self.owner, :create_build, project) end + + def trigger_schedule + super || build_trigger_schedule + end end end diff --git a/app/views/projects/triggers/_trigger.html.haml b/app/views/projects/triggers/_trigger.html.haml index 87d7c741bd6..9ab0cd3486c 100644 --- a/app/views/projects/triggers/_trigger.html.haml +++ b/app/views/projects/triggers/_trigger.html.haml @@ -30,7 +30,7 @@ Never %td - - if trigger.trigger_schedule.present? + - if trigger.trigger_schedule.persisted? = trigger.trigger_schedule.real_next_run - else N/A (External trigger)