From 139d38e6beb7719af3fb9621ef232bd15691ffcf Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 4 Mar 2020 15:29:55 +0800 Subject: [PATCH] =?UTF-8?q?tpi=E8=AF=84=E8=AE=BA=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=85=AC=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/discusses_controller.rb | 3 +-- .../20200304062256_modidy_hidden_default_for_discusses.rb | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20200304062256_modidy_hidden_default_for_discusses.rb diff --git a/app/controllers/discusses_controller.rb b/app/controllers/discusses_controller.rb index 3b1dff96b..e6570a8bf 100644 --- a/app/controllers/discusses_controller.rb +++ b/app/controllers/discusses_controller.rb @@ -81,8 +81,7 @@ class DiscussesController < ApplicationController begin @discuss = Discuss.create!(:dis_id => params[:container_id], :dis_type => params[:container_type], :content => params[:content].gsub(" \;", "").strip, :user_id => current_user.id, - :praise_count => 0, :position => params[:position], :challenge_id => params[:challenge_id], - :hidden => !current_user.admin?) # 管理员回复的能够显示 + :praise_count => 0, :position => params[:position], :challenge_id => params[:challenge_id]) rescue Exception => e uid_logger_error("create discuss failed : #{e.message}") raise Educoder::TipException.new("评论异常,原因:#{e.message}") diff --git a/db/migrate/20200304062256_modidy_hidden_default_for_discusses.rb b/db/migrate/20200304062256_modidy_hidden_default_for_discusses.rb new file mode 100644 index 000000000..331d2c945 --- /dev/null +++ b/db/migrate/20200304062256_modidy_hidden_default_for_discusses.rb @@ -0,0 +1,5 @@ +class ModidyHiddenDefaultForDiscusses < ActiveRecord::Migration[5.2] + def change + change_column :discusses, :hidden, :boolean, :default => false + end +end