diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 71b852e01..95e90d416 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -259,7 +259,7 @@ class ProjectsController < ApplicationController # Author lizanle # Description 项目动态展示方法,删除了不必要的代码 def show - + update_invite_message(User.current, @project) if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) return end @@ -464,6 +464,8 @@ class ProjectsController < ApplicationController # by young # include CoursesHelper def member + # 更新消息状态 + update_invite_message(User.current, @project) # 消息"同意加入项目" if params[:message_id] message_invite(params[:message_id], params[:key]) @@ -523,6 +525,13 @@ class ProjectsController < ApplicationController @members = paginateHelper @members end + def update_invite_message(user, project) + forge_invite_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =?", user, project, "ProjectInvite") + forge_invite_messages.each do |forge_invite_messages| + forge_invite_messages.update_attribute(:viewed, true) + end + end + def message_invite(message_id, key) forge_message = ForgeMessage.find(message_id) if key == forge_message.secret_key diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 46964b14d..6445215d5 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -364,7 +364,11 @@ <%=link_to inviter, user_path(inviter), :class => "newsBlue homepageNewsPublisher" %> ">邀请你加入项目: -