Commit 69486116 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Present all pipeline triggers using trigger presenter

parent 4d7f9351
...@@ -99,7 +99,9 @@ module Projects ...@@ -99,7 +99,9 @@ module Projects
def define_triggers_variables def define_triggers_variables
@triggers = @project.triggers @triggers = @project.triggers
.present(current_user: current_user)
@trigger = ::Ci::Trigger.new @trigger = ::Ci::Trigger.new
.present(current_user: current_user)
end end
def define_badges_variables def define_badges_variables
......
...@@ -30,7 +30,7 @@ module Ci ...@@ -30,7 +30,7 @@ module Ci
end end
def short_token def short_token
token[0...4] token[0...4] if token.present?
end end
def legacy? def legacy?
......
...@@ -85,7 +85,7 @@ module API ...@@ -85,7 +85,7 @@ module API
declared_params(include_missing: false).merge(owner: current_user)) declared_params(include_missing: false).merge(owner: current_user))
if trigger.valid? if trigger.valid?
present trigger, with: Entities::Trigger present trigger, with: Entities::Trigger, current_user: current_user
else else
render_validation_error!(trigger) render_validation_error!(trigger)
end end
...@@ -106,7 +106,7 @@ module API ...@@ -106,7 +106,7 @@ module API
break not_found!('Trigger') unless trigger break not_found!('Trigger') unless trigger
if trigger.update(declared_params(include_missing: false)) if trigger.update(declared_params(include_missing: false))
present trigger, with: Entities::Trigger present trigger, with: Entities::Trigger, current_user: current_user
else else
render_validation_error!(trigger) render_validation_error!(trigger)
end end
...@@ -127,7 +127,7 @@ module API ...@@ -127,7 +127,7 @@ module API
if trigger.update(owner: current_user) if trigger.update(owner: current_user)
status :ok status :ok
present trigger, with: Entities::Trigger present trigger, with: Entities::Trigger, current_user: current_user
else else
render_validation_error!(trigger) render_validation_error!(trigger)
end end
......
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