issue周报发送消息给所有管理员

This commit is contained in:
ouyangxuhua 2015-09-09 11:42:06 +08:00
parent 71f8fca68b
commit 20bef515da
2 changed files with 12 additions and 3 deletions

View File

@ -114,8 +114,10 @@ class IssuesController < ApplicationController
def show
# 当前用户查看指派给他的缺陷消息,则设置消息为已读
query = @issue.forge_messages
if User.current.id == @issue.assigned_to_id
query.update_all(:viewed => true)
query.each do |m|
if m.user_id == User.current.id
m.update_attribute(:viewed, true)
end
end
# 缺陷状态更新
query_journals = @issue.journals

View File

@ -147,6 +147,13 @@ class Issue < ActiveRecord::Base
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
if self.tracker_id == 5
self.project.members.each do |m|
if m.roles.first.to_s.include?("Manager") && m.user_id != self.author_id && m.user_id != self.assigned_to_id
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.project_id, :viewed => false)
end
end
end
end
# 更新缺陷
@ -1009,7 +1016,7 @@ class Issue < ActiveRecord::Base
if leaf.start_date
# Only move subtask if it starts at the same date as the parent
# or if it starts before the given date
if start_date == leaf.start_date || date > leaf.start_date
if start_date == leaf.start_date || date > leaf.start_date
leaf.reschedule_on!(date)
end
else