修改查看他人的主页的不能翻页的错误
This commit is contained in:
parent
8ba957291c
commit
406c6c9dae
|
@ -2049,15 +2049,31 @@ class UsersController < ApplicationController
|
|||
def show
|
||||
set_nav_status(NavStatues::HOME)
|
||||
# @user_projects = @user.projects.order("updated_on desc")
|
||||
messages_all = @user.project_relate_messages
|
||||
|
||||
@limit = 20
|
||||
|
||||
@message_count = messages_all.count
|
||||
# REDO:已删除的内容应该在页面中显示不点击
|
||||
@message_all_pages = Paginator.new @message_count, @limit, params['page'] || 1
|
||||
@offset ||= @message_all_pages.offset
|
||||
@message_alls = messages_all
|
||||
@message_alls = paginateHelper @message_alls, @limit
|
||||
if is_current_user
|
||||
messages_all = @user.project_relate_messages
|
||||
@message_count = messages_all.count
|
||||
# REDO:已删除的内容应该在页面中显示不点击
|
||||
@message_all_pages = Paginator.new @message_count, @limit, params['page'] || 1
|
||||
@offset ||= @message_all_pages.offset
|
||||
@message_alls = messages_all
|
||||
@message_alls = paginateHelper @message_alls, @limit
|
||||
else
|
||||
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").pluck(:shield_id)
|
||||
user_project_ids = (@user.favorite_projects.visible.pluck(:id)-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.pluck(:id)-shield_project_ids).join(",") + ")"
|
||||
messages_all = @user.other_project_relate_messages(user_project_ids)
|
||||
@message_count = messages_all.count
|
||||
# REDO:已删除的内容应该在页面中显示不点击
|
||||
@message_all_pages = Paginator.new @message_count, @limit, params['page'] || 1
|
||||
@offset ||= @message_all_pages.offset
|
||||
@message_alls = messages_all
|
||||
@message_alls = paginateHelper @message_alls, @limit
|
||||
end
|
||||
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
|
|
|
@ -427,6 +427,15 @@ class User < Principal
|
|||
MessageAll.find_by_sql(sql)
|
||||
end
|
||||
|
||||
#其他用户的项目消息
|
||||
def other_project_relate_messages(project_ids)
|
||||
sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on fm.project_id in #{project_ids} and ma.message_id=fm.id
|
||||
left join `applied_messages` apm on apm.project_id in #{project_ids} and ma.message_id=apm.id
|
||||
where (ma.user_id =#{id} and ma.message_type = 'ForgeMessage' and fm.user_id=#{id} and fm.forge_message_type != 'News') or
|
||||
(ma.user_id=#{id} and ma.message_type='AppliedMessage' and apm.applied_type = 'AppliedProject' and apm.user_id =#{id}) ORDER BY ma.created_at desc;"
|
||||
MessageAll.find_by_sql(sql)
|
||||
end
|
||||
|
||||
#未处理的消息通知
|
||||
def user_unsolve_messages
|
||||
sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<% if is_current_user %>
|
||||
$("#user-info-right-<%= @user.login %>").html("<%= j render partial: "users/usersInfo" %>");
|
||||
<% else %>
|
||||
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "user_activities"} )%>");
|
||||
<% end %>
|
||||
|
||||
|
||||
$("#user-info-right-<%= @user.login %>").html("<%= j render partial: "users/usersInfo" %>");
|
||||
|
||||
|
|
Loading…
Reference in New Issue