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

This commit is contained in:
Shinya Maeda 2017-04-07 19:24:20 +09:00 committed by Kamil Trzcinski
parent 4131ed2bd8
commit 2f5095c254
No known key found for this signature in database
GPG key ID: 4505F5C7E12C6A5A
4 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -34,7 +34,6 @@ class Projects::TriggersController < Projects::ApplicationController
end
def edit
@trigger.build_trigger_schedule unless @trigger.trigger_schedule.present?
end
def update

View file

@ -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

View file

@ -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)