tpm页面的被隐藏的评论显示权限有误

dev_sync_trustie
daiao 5 years ago
parent 48ea2adcf9
commit d48d25197a

@ -7,6 +7,8 @@ class DiscussesController < ApplicationController
def index
page = params[:page].to_i
offset = page * LIMIT
@manger = @container.has_manager?(current_user) || current_user.is_certification_teacher
# 总数,分页使用
if current_user.admin?
@disscuss_count = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil).count
@ -18,7 +20,6 @@ class DiscussesController < ApplicationController
{dis_id: @container.id, dis_type: @container.class.to_s, hidden: false, user_id: current_user.id})
@disscuss_count = disscusses.count("discusses.id")
end
@manger = @container.has_manager?(current_user)
if @manger
@discusses = disscusses.limit(LIMIT).joins("left join games on discusses.challenge_id = games.challenge_id and discusses.user_id = games.user_id")
.select("discusses.*, games.identifier").includes(:user, :praise_treads).offset(offset)

Loading…
Cancel
Save