Unverified Commit 7327fb4a authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Yorick Peterse
Browse files

Present all pipeline triggers using trigger presenter

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