优化项目消息更新代码
This commit is contained in:
parent
e20fe85ddf
commit
341308658d
|
@ -560,18 +560,9 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def update_message_status(user, project)
|
||||
project_invite_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =?", user, project, "ProjectInvite")
|
||||
project_invite_messages.each do |project_invite_message|
|
||||
project_invite_message.update_attribute(:viewed, true)
|
||||
end
|
||||
#更新被加入项目消息的viewed字段
|
||||
join_project_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type=?", user, project, "JoinProject")
|
||||
join_project_messages.each do |join_project|
|
||||
join_project.update_attribute(:viewed, true)
|
||||
end
|
||||
#更新被移出项目消息的viewed字段
|
||||
remove_project_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type=?", user, project, "RemoveFromProject")
|
||||
remove_project_messages.update_all(:viewed => true)
|
||||
# 更新加入项目消息
|
||||
project__messages = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'JoinProject', 'RemoveFromProject') and user_id =? and project_id =? ", user, project)
|
||||
project__messages.update_all(:viewed => true) unless project__messages.blank?
|
||||
end
|
||||
|
||||
def message_invite(message_id, key)
|
||||
|
|
Loading…
Reference in New Issue