From cd018385f7c5861b4e425e4d504dd7387d6beade Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 3 May 2024 12:43:53 -0300 Subject: [PATCH 1/2] fix: corregidos metodos donde se retorna site o post #13244 --- app/services/post_service.rb | 9 +++------ app/services/site_service.rb | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 9cc41323..f7da581d 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -24,8 +24,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 - auto_publish! + post.tap(&:auto_publish!) end # Crear un post anónimo, con opciones más limitadas. No usamos post. @@ -38,8 +37,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do params[:draft] = true commit(action: :created, add: [post.path.absolute]) if post.update(anon_post_params) - post - auto_publish! + post.tap(&:auto_publish!) end def update @@ -60,8 +58,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 - auto_publish! + post.tap(&:auto_publish!) end def destroy diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 4c83a6dd..1b9ccdb6 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -38,7 +38,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do deploy end - site + site.tap(&:auto_publish!) end # Actualiza el sitio y guarda los cambios en la configuración From 1c44c91f76e0b17f72a2ef6fcdbd0b49e4057875 Mon Sep 17 00:00:00 2001 From: jazzari Date: Tue, 7 May 2024 15:54:29 -0300 Subject: [PATCH 2/2] fix: corregido auto_publish! en Site_service y Post_service #13244 --- app/services/post_service.rb | 9 ++++++--- app/services/site_service.rb | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index f7da581d..256a617d 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -24,7 +24,8 @@ 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.tap(&:auto_publish!) + auto_publish! + post end # Crear un post anónimo, con opciones más limitadas. No usamos post. @@ -37,7 +38,8 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do params[:draft] = true commit(action: :created, add: [post.path.absolute]) if post.update(anon_post_params) - post.tap(&:auto_publish!) + auto_publish! + post end def update @@ -58,7 +60,8 @@ 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.tap(&:auto_publish!) + auto_publish! + post end def destroy diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 1b9ccdb6..0ce09c53 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -38,7 +38,8 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do deploy end - site.tap(&:auto_publish!) + auto_publish! + site end # Actualiza el sitio y guarda los cambios en la configuración