mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 02:36:21 +00:00
fix: modificado base_service a autopublishconcern #13244
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
e175863081
commit
919b015daf
3 changed files with 15 additions and 8 deletions
|
@ -1,5 +0,0 @@
|
|||
module BaseService
|
||||
def auto_publish!
|
||||
DeployJob.perform_later(site.id) if site.auto_publish?
|
||||
end
|
||||
end
|
10
app/services/concerns/autopublish.rb
Normal file
10
app/services/concerns/autopublish.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
|
||||
module AutoPublishConcern
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def auto_publish!
|
||||
DeployJob.perform_later(site.id) if site.auto_publish?
|
||||
end
|
||||
end
|
|
@ -3,8 +3,7 @@
|
|||
# Este servicio se encarga de crear artículos y guardarlos en git,
|
||||
# asignándoselos a une usuarie
|
||||
PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
|
||||
include BaseService
|
||||
|
||||
|
||||
# Crea un artículo nuevo
|
||||
#
|
||||
# @return Post
|
||||
|
@ -25,12 +24,13 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
|
|||
# Devolver el post aunque no se haya salvado para poder rescatar los
|
||||
# errores
|
||||
post
|
||||
include AutoPublishConcern
|
||||
end
|
||||
|
||||
# Crear un post anónimo, con opciones más limitadas. No usamos post.
|
||||
def create_anonymous
|
||||
# XXX: Confiamos en el parámetro de idioma porque estamos
|
||||
# verificándolos en Site#posts
|
||||
# verificándolos extend ActiveSupport::Concernn Site#posts
|
||||
self.post = site.posts(lang: locale)
|
||||
.build(layout: layout)
|
||||
# Los artículos anónimos siempre son borradores
|
||||
|
@ -38,6 +38,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
|
|||
|
||||
commit(action: :created, add: [post.path.absolute]) if post.update(anon_post_params)
|
||||
post
|
||||
include AutoPublishConcern
|
||||
end
|
||||
|
||||
def update
|
||||
|
@ -59,6 +60,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
|
|||
# Devolver el post aunque no se haya salvado para poder rescatar los
|
||||
# errores
|
||||
post
|
||||
include AutoPublishConcern
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
Loading…
Reference in a new issue