From 8896c18ef96d91a0b64dbc12d3c49094cbd7d167 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 30 Sep 2019 15:41:50 -0300 Subject: [PATCH] los articulos editados por invitades siempre son borradores --- app/services/post_service.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index a2008e9..fddb0b6 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -11,6 +11,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do # TODO: Implementar layout self.post = site.posts(lang: params[:post][:lang] || I18n.locale).build post.usuaries << usuarie + params[:post][:draft] = true if site.invitade? usuarie commit(action: :created) if post.update(post_params) @@ -21,6 +22,8 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do def update post.usuaries << usuarie + params[:post][:draft] = true if site.invitade? usuarie + commit(action: :updated) if post.update(post_params) # Devolver el post aunque no se haya salvado para poder rescatar los