From a85fbe4ff18caf2d942418801ab1d8694f4e8269 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Tue, 4 Feb 2014 11:42:03 -0600 Subject: [PATCH] bring back moderation_reason for moderators --- app/controllers/stories_controller.rb | 11 +++++++++-- app/views/stories/edit.html.erb | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 82a092a..fb3edc6 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -226,9 +226,16 @@ class StoriesController < ApplicationController private def story_params - params.require(:story).permit( - :title, :url, :description, :seen_previous, :tags_a => [] + p = params.require(:story).permit( + :title, :url, :description, :moderation_reason, :seen_previous, + :tags_a => [], ) + + if @user.is_moderator? + p + else + p.except(:moderation_reason) + end end def find_story diff --git a/app/views/stories/edit.html.erb b/app/views/stories/edit.html.erb index 57d5274..239c495 100644 --- a/app/views/stories/edit.html.erb +++ b/app/views/stories/edit.html.erb @@ -8,7 +8,7 @@ <%= render :partial => "stories/form", :locals => { :story => @story, :f => f } %> - <% if @story.user_id != @user.id %> + <% if @user.is_moderator? && (@story.user_id != @user.id) %>
<%= f.label :moderation_reason, "Mod Reason:",