讨论区的消消息问题

dev_tj
daiao 5 years ago
parent eefaa53669
commit d361e6a18b

@ -11,9 +11,9 @@ class DiscussesController < ApplicationController
# 总数,分页使用 # 总数,分页使用
if @manger if @manger
@disscuss_count = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil).count
disscusses = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, disscusses = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s,
:root_id => nil) :root_id => nil)
@disscuss_count = disscusses.count
@discusses = disscusses.joins("left join games on discusses.challenge_id = games.challenge_id and discusses.user_id = games.user_id") @discusses = disscusses.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).limit(LIMIT).offset(offset) .select("discusses.*, games.identifier").includes(:user, :praise_treads).limit(LIMIT).offset(offset)
else else

@ -26,7 +26,7 @@ class GamesController < ApplicationController
game_count = Game.where(myshixun_id: @game.myshixun_id).count game_count = Game.where(myshixun_id: @game.myshixun_id).count
discusses = @shixun.discusses discusses = @shixun.discusses
discusses = discusses.where('hidden = false OR user_id = :user_id', user_id: current_user.id) unless current_user.admin? discusses = discusses.where('hidden = false OR user_id = :user_id', user_id: current_user.id) unless current_user.admin_or_business?
discusses_count = discusses.count discusses_count = discusses.count
@user = @game.owner @user = @game.owner

Loading…
Cancel
Save