From 5594295c9e61a45356e3261e035b50cdd47c99f1 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 21 Aug 2015 15:27:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=97=AE=E9=A2=98=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=AD=96=E7=95=A5=20=E6=98=BE=E7=A4=BA=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/users_helper.rb | 8 ++++++++ app/models/issue.rb | 11 ++++++++++- app/models/journal.rb | 8 +++++--- app/views/users/user_messages.html.erb | 8 ++++---- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 49865d335..48019e597 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -402,6 +402,14 @@ module UsersHelper return str.html_safe end + def get_issue_des_update(journal) + arr = details_to_strings(journal.details,true) + arr << journal.notes + str = '' + arr.each { |item| str = str+item } + return str + end + def get_activity_act_showname(activity) case activity.act_type when "HomeworkCommon" diff --git a/app/models/issue.rb b/app/models/issue.rb index 66627c00a..1724e3484 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -83,7 +83,7 @@ class Issue < ActiveRecord::Base # fq after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message - after_update :be_user_score + after_update :be_user_score, :act_as_forge_message_update after_destroy :down_user_score # after_create :be_user_score # end @@ -150,6 +150,15 @@ class Issue < ActiveRecord::Base :viewed => false) end end + + # 更新缺陷 + def act_as_forge_message_update + unless self.author_id == self.assigned_to_id + self.forge_messages << ForgeMessage.new(:user_id => self.assigned_to_id, + :project_id => self.project_id, + :viewed => false) + end + end # Returns a SQL conditions string used to find all issues visible by the specified user diff --git a/app/models/journal.rb b/app/models/journal.rb index c705b1a09..a5bea92af 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -171,9 +171,11 @@ class Journal < ActiveRecord::Base # 缺陷状态更改,消息提醒 def act_as_forge_message - self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, - :project_id => self.issue.project_id, - :viewed => false) + if self.user_id != self.issue.author_id + self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, + :project_id => self.issue.project_id, + :viewed => false) + end end # 更新用户分数 -by zjc diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 17ee0957a..c1b57aabb 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -153,11 +153,11 @@ "><%= ufm.forge_message.user %>
  • "> - <%= ufm.forge_message.notes.empty? ? "更新了问题状态" : "在问题中留言了" %>
  • + 更新了问题
  • - <%= link_to ("#{ufm.forge_message.notes.empty? ? ufm.forge_message.issue.subject.html_safe : ufm.forge_message.notes.html_safe }"), + <%= link_to get_issue_des_update(ufm.forge_message), issue_path(:id => ufm.forge_message.journalized_id), :class => "#{ufm.viewed == 0 ? "newsBlack" : "newsGrey"}", - :title => "#{ufm.forge_message.notes.empty? ? ufm.forge_message.issue.subject.html_safe : ufm.forge_message.notes.html_safe }" %> + :title => "#{get_issue_des_update(ufm.forge_message)}" %>
  • <%= time_tag(ufm.forge_message.created_on).html_safe %>
  • @@ -216,7 +216,7 @@
  • <%= urm.memo.author %>
  • -
  • 回复了贴吧帖子
  • +
  • 新建贴吧帖子
  • <%= link_to urm.memo.content.html_safe, forum_memo_path(urm.memo.forum_id, urm.memo.parent_id ? urm.memo.parent_id: urm.memo.id),:class => "newsGrey" , :title => "#{urm.memo.content.html_safe}" %>