mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 15:46:22 +00:00
fix: garantizar que el sitio está indexado antes de verlo
(cherry picked from commit 39ea2d25fc
)
This commit is contained in:
parent
8c50775218
commit
0d781b6a15
3 changed files with 5 additions and 11 deletions
|
@ -96,7 +96,9 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def site
|
def site
|
||||||
@site ||= find_site
|
@site ||= find_site.tap do |s|
|
||||||
|
s.reindex_changes!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -6,9 +6,6 @@ class Post
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
# Indexa o reindexa el Post
|
|
||||||
after_save :index!
|
|
||||||
after_destroy :remove_from_index!
|
|
||||||
|
|
||||||
# @return [IndexedPost,nil]
|
# @return [IndexedPost,nil]
|
||||||
def indexed_post
|
def indexed_post
|
||||||
|
|
|
@ -76,16 +76,11 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
||||||
commit_config(action: :tor)
|
commit_config(action: :tor)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Trae cambios desde la rama remota y reindexa los artículos.
|
# Trae cambios desde la rama remota
|
||||||
#
|
#
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def merge
|
def merge
|
||||||
result = site.repository.merge(usuarie)
|
site.repository.merge(usuarie).present?
|
||||||
|
|
||||||
# TODO: Implementar callbacks
|
|
||||||
site.try(:index_posts!) if result
|
|
||||||
|
|
||||||
result.present?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in a new issue