Merge branch 'develop' into 'develop'
系统消息类型接口封装公用 See merge request !123
This commit is contained in:
commit
0cde026d5f
|
@ -44,6 +44,7 @@ class UsersController < ApplicationController
|
||||||
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
|
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
|
||||||
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community]
|
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community]
|
||||||
before_filter :auth_user_extension, only: :show
|
before_filter :auth_user_extension, only: :show
|
||||||
|
before_filter :show_system_message, :only => [:show]
|
||||||
#before_filter :rest_user_score, only: :show
|
#before_filter :rest_user_score, only: :show
|
||||||
#before_filter :select_entry, only: :user_projects
|
#before_filter :select_entry, only: :user_projects
|
||||||
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
|
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
|
||||||
|
@ -2006,8 +2007,6 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
def show
|
def show
|
||||||
if User.current == @user
|
if User.current == @user
|
||||||
# 系统消息总显示在最前面,显示周期30天
|
|
||||||
@system_messages = SystemMessage.where("created_at > ?", Time.now - 86400 * 30)
|
|
||||||
# 全部设为已读
|
# 全部设为已读
|
||||||
if params[:viewed] == "all"
|
if params[:viewed] == "all"
|
||||||
update_message_viewed(@user)
|
update_message_viewed(@user)
|
||||||
|
@ -2053,6 +2052,8 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# 待审批的申请
|
# 待审批的申请
|
||||||
@applied_message_alls = []
|
@applied_message_alls = []
|
||||||
|
OrgMessage
|
||||||
|
|
||||||
applied_messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message)
|
applied_messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage", "ForgeMessage"]).includes(:message)
|
||||||
applied_messages_all.each do |message_all|
|
applied_messages_all.each do |message_all|
|
||||||
mess = message_all.message
|
mess = message_all.message
|
||||||
|
@ -4407,6 +4408,10 @@ def homepage
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
def show_system_message
|
||||||
|
# 系统消息总显示在最前面,显示周期30天
|
||||||
|
@system_messages = SystemMessage.where("created_at > ?", Time.now - 86400 * 30)
|
||||||
|
end
|
||||||
|
|
||||||
def find_user
|
def find_user
|
||||||
if params[:id] == 'current'
|
if params[:id] == 'current'
|
||||||
|
|
Loading…
Reference in New Issue