Add def trigger_schedule in Trigger. Use persisted? for checling existance
This commit is contained in:
parent
4131ed2bd8
commit
2f5095c254
4 changed files with 5 additions and 3 deletions
|
@ -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
|
||||||
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
|
||||||
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 @@
|
||||||
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)
|
||||||
|
|
Loading…
Reference in a new issue