Commit 2f5095c2 authored by Shinya Maeda's avatar Shinya Maeda Committed by Kamil Trzcinski

Add def trigger_schedule in Trigger. Use persisted? for checling existance

parent 4131ed2b
...@@ -27,7 +27,6 @@ module Projects ...@@ -27,7 +27,6 @@ module Projects
def define_triggers_variables def define_triggers_variables
@triggers = @project.triggers @triggers = @project.triggers
@trigger = Ci::Trigger.new @trigger = Ci::Trigger.new
@trigger.build_trigger_schedule
end end
def define_badges_variables def define_badges_variables
......
...@@ -34,7 +34,6 @@ class Projects::TriggersController < Projects::ApplicationController ...@@ -34,7 +34,6 @@ class Projects::TriggersController < Projects::ApplicationController
end end
def edit def edit
@trigger.build_trigger_schedule unless @trigger.trigger_schedule.present?
end end
def update def update
......
...@@ -39,5 +39,9 @@ module Ci ...@@ -39,5 +39,9 @@ module Ci
def can_access_project? def can_access_project?
self.owner_id.blank? || Ability.allowed?(self.owner, :create_build, project) self.owner_id.blank? || Ability.allowed?(self.owner, :create_build, project)
end end
def trigger_schedule
super || build_trigger_schedule
end
end end
end end
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
Never Never
%td %td
- if trigger.trigger_schedule.present? - if trigger.trigger_schedule.persisted?
= trigger.trigger_schedule.real_next_run = trigger.trigger_schedule.real_next_run
- else - else
N/A (External trigger) N/A (External trigger)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment