5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-01 06:06:07 +00:00

los articulos editados por invitades siempre son borradores

This commit is contained in:
f 2019-09-30 15:41:50 -03:00
parent 5f3bbbfb1f
commit 8896c18ef9
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D

View file

@ -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