From d0b17f2a7712c2293cfe60bdc965ee7da4677d52 Mon Sep 17 00:00:00 2001 From: Jess Lee Date: Wed, 23 Jan 2019 11:58:11 -0500 Subject: [PATCH] Adds internal/articles input to update author (#1628) * adds input to change article author * remove link * remove unnecessary attribute --- app/controllers/internal/articles_controller.rb | 5 ++++- app/views/internal/articles/_individual_article.html.erb | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/internal/articles_controller.rb b/app/controllers/internal/articles_controller.rb index b24bb8e3b..d022a3ffb 100644 --- a/app/controllers/internal/articles_controller.rb +++ b/app/controllers/internal/articles_controller.rb @@ -73,6 +73,8 @@ class Internal::ArticlesController < Internal::ApplicationController article.email_digest_eligible = article_params[:email_digest_eligible].to_s == "true" article.boosted_additional_articles = article_params[:boosted_additional_articles].to_s == "true" article.boosted_dev_digest_email = article_params[:boosted_dev_digest_email].to_s == "true" + article.user_id = article_params[:user_id].to_i + article.update!(article_params) if article.live_now Article.where.not(id: article.id).where(live_now: true).update_all(live_now: false) @@ -95,6 +97,7 @@ class Internal::ArticlesController < Internal::ApplicationController :boosted_additional_articles, :boosted_dev_digest_email, :main_image_background_hex_color, - :featured_number) + :featured_number, + :user_id) end end diff --git a/app/views/internal/articles/_individual_article.html.erb b/app/views/internal/articles/_individual_article.html.erb index 02d3c81a9..68b84c957 100644 --- a/app/views/internal/articles/_individual_article.html.erb +++ b/app/views/internal/articles/_individual_article.html.erb @@ -44,7 +44,7 @@ <% article.decorate.cached_tag_list_array.each do |tag| %> #<%= tag %> <% end %> - @<%= article.user&.username %> ❤️ <%= article.positive_reactions_count %> | 💬 <%= article.comments_count %> | ID: <%= article.id %> + @<%= article.user&.username %> ❤️ <%= article.positive_reactions_count %> | 💬 <%= article.comments_count %>

@@ -52,6 +52,7 @@ Featured Number: + Change author:   Featured: >   Approved: >   Live Now: >