diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 3a48aa20..b1059b2b 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -45,8 +45,12 @@ class PostsController < ApplicationController @post = Post.new(site: @site, lang: @lang, template: @template) @post.update_attributes(repair_nested_params(post_params)) - # El author no se modifica - @post.update_attributes({author: current_user.username}) + # Las usuarias pueden especificar una autora, de la contrario por + # defecto es la usuaria actual + if current_user.is_a? Usuaria + @post.update_attributes({author: params[:post][:author]}) + end + @post.update_attributes({author: current_user.username}) unless @post.author if @post.save redirect_to site_posts_path(@site, lang: @lang) diff --git a/app/views/posts/_form.haml b/app/views/posts/_form.haml index 13b1804f..99da1da2 100644 --- a/app/views/posts/_form.haml +++ b/app/views/posts/_form.haml @@ -24,7 +24,7 @@ = label_tag 'post_author', t('posts.author') - todxs = (@site.usuarias + @site.invitadxs).map(&:username) = select_tag 'post[author]', - options_for_select(todxs, @post.author), + options_for_select(todxs, @post.author || current_user.email), { class: 'form-control select2', data: { tags: true, placeholder: t('posts.select.placeholder'),