dev_trainings
cxt 6 years ago
commit c41ee264f4

@ -119,6 +119,9 @@ class ShixunsService
@children_list = [] @children_list = []
# 目前只取十个不多N+1问题不大 # 目前只取十个不多N+1问题不大
# 需要彻底解决则需要改数据路结构比如Nested算法可以解决 # 需要彻底解决则需要改数据路结构比如Nested算法可以解决
unless current_user.admin?
discusses = discusses.where(:hidden => false)
end
if discusses.present? if discusses.present?
discusses.each do |d| discusses.each do |d|
# 总点赞数 # 总点赞数

@ -0,0 +1,8 @@
class ModifyHiddenDefualtForDiscusses < ActiveRecord::Migration
def up
change_column :discusses, :hidden, :boolean, :default => true
end
def down
end
end

@ -213,11 +213,12 @@ class Comments extends Component {
<div className="comment_content clearfix" id={`reply_content_${item.id}`}> <div className="comment_content clearfix" id={`reply_content_${item.id}`}>
<div className="color-grey-3 break_word_comments" id={`reply_content_${item.id}`}> <div className="color-grey-3 break_word_comments" id={`reply_content_${item.id}`}>
{/* 改成后端返回了的都是要显示的不管hidden的值是true还是false */}
{ item.hidden && comment.admin === false && comment.manager === false {/* { item.hidden && comment.admin === false && comment.manager === false
? <p className="color-orange font-16">违规评论已被屏蔽</p> ? <p className="color-orange font-16">违规评论已被屏蔽</p>
: <div dangerouslySetInnerHTML={{__html: _content}}></div> : */}
} <div dangerouslySetInnerHTML={{__html: _content}}></div>
{/* } */}
<div className="cl"></div> <div className="cl"></div>
</div> </div>
@ -309,10 +310,12 @@ class Comments extends Component {
<div className="comment_content clearfix" id={`reply_content_${item.id}`}> <div className="comment_content clearfix" id={`reply_content_${item.id}`}>
<div className="color-grey-3 break_word_comments" id={`reply_content_${item.id}`}> <div className="color-grey-3 break_word_comments" id={`reply_content_${item.id}`}>
{ item.hidden && item.admin === false && (item.manager === false || item.manager == undefined) {/* 改成后端返回了的都是要显示的不管hidden的值是true还是false */}
{/* { item.hidden && item.admin === false && (item.manager === false || item.manager == undefined)
? <p className="color-orange font-16">违规评论已被屏蔽</p> ? <p className="color-orange font-16">违规评论已被屏蔽</p>
: <div dangerouslySetInnerHTML={{__html: _content}}></div> : */}
} <div dangerouslySetInnerHTML={{__html: _content}}></div>
{/* } */}
<div className="cl"></div> <div className="cl"></div>
</div> </div>
</div> </div>

Loading…
Cancel
Save