mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-17 06:36:22 +00:00
feat: move methods to private #13903
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
23732bbfe0
commit
f2236bb305
1 changed files with 14 additions and 11 deletions
|
@ -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
|
||||||
|
@ -37,17 +50,7 @@ module Api
|
||||||
|
|
||||||
def usuarie
|
def usuarie
|
||||||
@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
|
||||||
|
|
Loading…
Reference in a new issue