Merge branch 'dev-homepage-revision' of http://git.trustie.net/jacknudt/trustieforge into dev-homepage-revision
This commit is contained in:
commit
bada310c64
|
@ -2049,15 +2049,31 @@ class UsersController < ApplicationController
|
||||||
def show
|
def show
|
||||||
set_nav_status(NavStatues::HOME)
|
set_nav_status(NavStatues::HOME)
|
||||||
# @user_projects = @user.projects.order("updated_on desc")
|
# @user_projects = @user.projects.order("updated_on desc")
|
||||||
messages_all = @user.project_relate_messages
|
|
||||||
@limit = 20
|
@limit = 20
|
||||||
|
|
||||||
@message_count = messages_all.count
|
if is_current_user
|
||||||
# REDO:已删除的内容应该在页面中显示不点击
|
messages_all = @user.project_relate_messages
|
||||||
@message_all_pages = Paginator.new @message_count, @limit, params['page'] || 1
|
@message_count = messages_all.count
|
||||||
@offset ||= @message_all_pages.offset
|
# REDO:已删除的内容应该在页面中显示不点击
|
||||||
@message_alls = messages_all
|
@message_all_pages = Paginator.new @message_count, @limit, params['page'] || 1
|
||||||
@message_alls = paginateHelper @message_alls, @limit
|
@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|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
format.html {render :layout => 'new_base_user'}
|
format.html {render :layout => 'new_base_user'}
|
||||||
|
|
|
@ -427,6 +427,15 @@ class User < Principal
|
||||||
MessageAll.find_by_sql(sql)
|
MessageAll.find_by_sql(sql)
|
||||||
end
|
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
|
def user_unsolve_messages
|
||||||
sql = "SELECT * FROM `message_alls` ma left join `forge_messages` fm on ma.message_id=fm.id
|
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 %>
|
$("#user-info-right-<%= @user.login %>").html("<%= j render partial: "users/usersInfo" %>");
|
||||||
$("#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 %>
|
|
||||||
|
|
Loading…
Reference in New Issue