5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 15:31:43 +00:00

reindexar después de mergear

This commit is contained in:
f 2021-05-31 13:23:40 -03:00
parent 4609ab21b2
commit 7191baff4a
2 changed files with 13 additions and 1 deletions

View file

@ -107,7 +107,7 @@ class SitesController < ApplicationController
def merge
authorize site
if site.repository.merge(current_usuarie)
if SiteService.new(site: site, usuarie: current_usuarie).merge
flash[:success] = I18n.t('sites.fetch.merge.success')
else
flash[:error] = I18n.t('sites.fetch.merge.error')

View file

@ -61,6 +61,18 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
commit_config(action: :tor)
end
# Trae cambios desde la rama remota y reindexa los artículos.
#
# @return [Boolean]
def merge
result = site.repository.merge(usuarie)
# TODO: Implementar callbacks
site.try(:index_posts!) if result
result.present?
end
private
# Guarda los cambios de la configuración en el repositorio git