5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-17 08:36:38 +00:00

feat: move methods to private #13903
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
jazzari 2023-08-14 16:49:24 -03:00
parent 23732bbfe0
commit f2236bb305

View file

@ -6,6 +6,19 @@ module Api
class WebhooksController < BaseController class WebhooksController < BaseController
rescue_from ActiveRecord::RecordNotFound, with: :platforms_answer rescue_from ActiveRecord::RecordNotFound, with: :platforms_answer
# Trae los cambios a partir de un post de Webhooks:
# (Gitlab, Github, Guitea, etc)
def pull
message = I18n.with_locale(site.default_locale) do
I18n.t('webhooks.pull.message')
end
GitPullJob.perform_later(site, usuarie, message)
platforms_answer
end
private
def site def site
@site ||= Site.find_by_name!(params[:site_id]) @site ||= Site.find_by_name!(params[:site_id])
end end
@ -39,16 +52,6 @@ module Api
@usuarie = site.roles.find_by!(temporal: false, rol: 'usuarie', token: token).usuarie @usuarie = site.roles.find_by!(temporal: false, rol: 'usuarie', token: token).usuarie
end end
# Trae los cambios a partir de un post de Webhooks:
# (Gitlab, Github, Guitea, etc)
def pull
message = I18n.with_locale(site.default_locale) do
I18n.t('webhooks.pull.message')
end
GitPullJob.perform_later(site, usuarie, message)
end
def platforms_answer def platforms_answer
head :ok head :ok
end end