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