添加问题更新策略

显示更新内容
This commit is contained in:
huang 2015-08-21 15:27:01 +08:00
parent a53e66d4b0
commit 5594295c9e
4 changed files with 27 additions and 8 deletions

View File

@ -402,6 +402,14 @@ module UsersHelper
return str.html_safe return str.html_safe
end 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) def get_activity_act_showname(activity)
case activity.act_type case activity.act_type
when "HomeworkCommon" when "HomeworkCommon"

View File

@ -83,7 +83,7 @@ class Issue < ActiveRecord::Base
# fq # fq
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message 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_destroy :down_user_score
# after_create :be_user_score # after_create :be_user_score
# end # end
@ -150,6 +150,15 @@ class Issue < ActiveRecord::Base
:viewed => false) :viewed => false)
end end
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 # Returns a SQL conditions string used to find all issues visible by the specified user

View File

@ -171,9 +171,11 @@ class Journal < ActiveRecord::Base
# 缺陷状态更改,消息提醒 # 缺陷状态更改,消息提醒
def act_as_forge_message def act_as_forge_message
self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, if self.user_id != self.issue.author_id
:project_id => self.issue.project_id, self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id,
:viewed => false) :project_id => self.issue.project_id,
:viewed => false)
end
end end
# 更新用户分数 -by zjc # 更新用户分数 -by zjc

View File

@ -153,11 +153,11 @@
<a href="javascript:void(0);" class="<%= ufm.viewed == 0 ? "newsBlack" : "newsBlue" %>"><%= ufm.forge_message.user %></a> <a href="javascript:void(0);" class="<%= ufm.viewed == 0 ? "newsBlack" : "newsBlue" %>"><%= ufm.forge_message.user %></a>
</li> </li>
<li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>"> <li class="<%= ufm.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">
<%= ufm.forge_message.notes.empty? ? "更新了问题状态" : "在问题中留言了" %></li> 更新了问题
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= 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"}", 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 }" %></a> :title => "#{get_issue_des_update(ufm.forge_message)}" %></a>
</li> </li>
<li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ufm.forge_message.created_on).html_safe %> </li>
</ul> </ul>
@ -216,7 +216,7 @@
<li class="homepageNewsPublisher fl"> <li class="homepageNewsPublisher fl">
<a href="javascript:void(0);" class="newsBlue"><%= urm.memo.author %></a> <a href="javascript:void(0);" class="newsBlue"><%= urm.memo.author %></a>
</li> </li>
<li class="homepageNewsType fl" >回复了贴吧帖子</li> <li class="homepageNewsType fl" >新建贴吧帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= 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}" %></a> <%= 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}" %></a>
</li> </li>