todo lo que hacen lxs invitadxs se marca como borrador
This commit is contained in:
parent
32d8ebd1e8
commit
fec0372073
2 changed files with 11 additions and 2 deletions
|
@ -49,10 +49,14 @@ class PostsController < ApplicationController
|
|||
# defecto es la usuaria actual
|
||||
if current_user.is_a? Usuaria
|
||||
@post.update_attributes({author: params[:post][:author]})
|
||||
else
|
||||
# Todo lo que crean lxs invitadxs es borrador
|
||||
@post.update_attributes({draft: true})
|
||||
end
|
||||
@post.update_attributes({author: current_user.username}) unless @post.author
|
||||
|
||||
if @post.save
|
||||
flash[:success] = @site.config.dig('thanks')
|
||||
redirect_to site_posts_path(@site, lang: @lang)
|
||||
else
|
||||
render 'posts/new'
|
||||
|
@ -78,10 +82,15 @@ class PostsController < ApplicationController
|
|||
|
||||
# Solo las usuarias pueden modificar la autoría
|
||||
if current_user.is_a? Usuaria
|
||||
@post.update_attributes({author: params[:post][:author]})
|
||||
@post.update_attributes({author: params[:post][:author]}) if params[:post][:author].present?
|
||||
@post.update_attributes({draft: false})
|
||||
else
|
||||
# Todo lo que crean lxs invitadxs es borrador
|
||||
@post.update_attributes({draft: true})
|
||||
end
|
||||
|
||||
if @post.save
|
||||
flash[:success] = @site.config.dig('thanks')
|
||||
redirect_to site_posts_path(@site, category: session[:category], lang: @lang)
|
||||
else
|
||||
render 'posts/edit'
|
||||
|
|
|
@ -20,7 +20,7 @@ class Post
|
|||
|
||||
REJECT_FROM_DATA = %w[excerpt].freeze
|
||||
# datos que no tienen que terminar en el front matter
|
||||
REJECT_FROM_FRONT_MATTER = %w[date slug draft ext].freeze
|
||||
REJECT_FROM_FRONT_MATTER = %w[date slug ext].freeze
|
||||
# datos que no traemos del template
|
||||
REJECT_FROM_TEMPLATE = %w[draft categories layout title ext tags date slug].freeze
|
||||
DEFAULT_PARAMS = [:title, :date, :content, :slug, :cover,
|
||||
|
|
Loading…
Reference in a new issue