mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-17 08:26:22 +00:00
Merge branch 'search-engine' into staging
This commit is contained in:
commit
99e9ec2659
3 changed files with 22 additions and 2 deletions
|
@ -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')
|
||||
|
|
|
@ -23,7 +23,15 @@ class MetadataArray < MetadataTemplate
|
|||
value.join(', ')
|
||||
end
|
||||
|
||||
alias indexable_values values
|
||||
# Obtiene el valor desde el documento, convirtiéndolo a Array si no lo
|
||||
# era ya, por retrocompabilidad.
|
||||
#
|
||||
# @return [Array]
|
||||
def document_value
|
||||
[super].flatten(1)
|
||||
end
|
||||
|
||||
alias indexable_values value
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue