5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-26 00:16:22 +00:00

fix: garantizar que el sitio está indexado antes de verlo

This commit is contained in:
f 2023-10-26 18:12:30 -03:00
parent 3b656f1908
commit 39ea2d25fc
No known key found for this signature in database
3 changed files with 5 additions and 11 deletions

View file

@ -96,7 +96,9 @@ class ApplicationController < ActionController::Base
end
def site
@site ||= find_site
@site ||= find_site.tap do |s|
s.reindex_changes!
end
end
protected

View file

@ -6,9 +6,6 @@ class Post
extend ActiveSupport::Concern
included do
# Indexa o reindexa el Post
after_save :index!
after_destroy :remove_from_index!
# @return [IndexedPost,nil]
def indexed_post

View file

@ -76,16 +76,11 @@ 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.
# Trae cambios desde la rama remota
#
# @return [Boolean]
def merge
result = site.repository.merge(usuarie)
# TODO: Implementar callbacks
site.try(:index_posts!) if result
result.present?
site.repository.merge(usuarie).present?
end
private