5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 04:06:21 +00:00

todo lo que hacen lxs invitadxs se marca como borrador

This commit is contained in:
f 2018-10-01 19:36:58 -03:00
parent 32d8ebd1e8
commit fec0372073
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
2 changed files with 11 additions and 2 deletions

View file

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

View file

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