From a0ea38196bf30584d50193c75de5a219da4998aa Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 5 Jun 2019 14:53:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E9=99=A4=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E5=A4=96=EF=BC=8C=E5=85=B6=E4=BB=96=E4=BA=BA=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/shixuns_service.rb | 3 +++ .../20190605063236_modify_hidden_defualt_for_discusses.rb | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 db/migrate/20190605063236_modify_hidden_defualt_for_discusses.rb diff --git a/app/services/shixuns_service.rb b/app/services/shixuns_service.rb index 69bbc431..b7834ea7 100644 --- a/app/services/shixuns_service.rb +++ b/app/services/shixuns_service.rb @@ -119,6 +119,9 @@ class ShixunsService @children_list = [] # 目前只取十个,不多N+1问题不大 # 需要彻底解决则需要改数据路结构,比如Nested算法可以解决 + unless current_user.admin? + discusses = discusses.where(:hidden => false) + end if discusses.present? discusses.each do |d| # 总点赞数 diff --git a/db/migrate/20190605063236_modify_hidden_defualt_for_discusses.rb b/db/migrate/20190605063236_modify_hidden_defualt_for_discusses.rb new file mode 100644 index 00000000..9e026906 --- /dev/null +++ b/db/migrate/20190605063236_modify_hidden_defualt_for_discusses.rb @@ -0,0 +1,8 @@ +class ModifyHiddenDefualtForDiscusses < ActiveRecord::Migration + def up + change_column :discusses, :hidden, :boolean, :default => true + end + + def down + end +end From 487323a49ea9ef7171f35aaea0667b916571e31f Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 5 Jun 2019 15:10:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=94=B9=E6=88=90=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=BA=86=E7=9A=84=EF=BC=8C=E9=83=BD=E6=98=AF?= =?UTF-8?q?=E8=A6=81=E6=98=BE=E7=A4=BA=E7=9A=84=EF=BC=8C=E4=B8=8D=E7=AE=A1?= =?UTF-8?q?hidden=E7=9A=84=E5=80=BC=E6=98=AFtrue=E8=BF=98=E6=98=AFfalse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/comment/Comments.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js index 250cf16b..d1ac57d4 100644 --- a/public/react/src/modules/comment/Comments.js +++ b/public/react/src/modules/comment/Comments.js @@ -213,11 +213,12 @@ class Comments extends Component {
违规评论已被屏蔽!
- : - } + : */} + + {/* } */}违规评论已被屏蔽!
- : - } + : */} + + {/* } */}