parent
b49d19cdb2
commit
48b93f2113
|
@ -223,7 +223,6 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
if saved
|
||||
|
||||
#修改界面增加跟踪者
|
||||
watcherlist = @issue.watcher_users
|
||||
select_users = []
|
||||
|
@ -253,9 +252,7 @@ class IssuesController < ApplicationController
|
|||
JournalReply.add_reply(@issue.current_journal.id, reply_id, User.current.id)
|
||||
end
|
||||
flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record?
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
format.html { redirect_to issue_url(@issue.id) }
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
|
|
|
@ -171,11 +171,16 @@ class Journal < ActiveRecord::Base
|
|||
|
||||
# 缺陷状态更改,消息提醒
|
||||
def act_as_forge_message
|
||||
receivers = []
|
||||
# 直接回复
|
||||
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)
|
||||
receivers << self.issue.author_id
|
||||
end
|
||||
if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送
|
||||
self.forge_messages << ForgeMessage.new(:user_id => self.issue.assigned_to_id, :project_id => self.issue.project_id, :viewed => false)
|
||||
receivers << self.issue.assigned_to_id
|
||||
end
|
||||
receivers.each do |r|
|
||||
self.forge_messages << ForgeMessage.new(:user_id => r, :project_id => self.issue.project_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,8 +5,33 @@ class JournalReply < ActiveRecord::Base
|
|||
|
||||
belongs_to :user
|
||||
belongs_to :journal
|
||||
after_create :send_journal_messages
|
||||
|
||||
def self.add_reply(journal_id, reply_id, user_id)
|
||||
self.create(:journal_id => journal_id, :reply_id => reply_id, :user_id => user_id)
|
||||
end
|
||||
|
||||
def send_journal_messages
|
||||
journal = self.journal
|
||||
replier = User.find(self.reply_id)
|
||||
receivers = []
|
||||
# 被回复的人发送消息
|
||||
if journal.user_id != self.reply_id
|
||||
receivers << self.replier
|
||||
end
|
||||
if journal.user_id != journal.issue.author_id && self.reply_id != journal.issue.author_id
|
||||
receivers << self.journal.issue.author
|
||||
end
|
||||
receivers.each do |r|
|
||||
journal.forge_messages << ForgeMessage.new(:user_id =>r, :project_id => journal.issue.project, :viewed => false)
|
||||
end
|
||||
|
||||
# if self.user_id != self.journal_reply.user_id
|
||||
# receivers << self.journal_reply.user_id
|
||||
# end
|
||||
# # 给缺陷发布者发送
|
||||
# if self.user_id != self.issue.author_id && self.journal_reply.user_id != self.issue.author_id
|
||||
# receivers << self.issue.author_id
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,15 +6,9 @@
|
|||
<div id="all_attributes" style="display:none;">
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<div class="ping_C mb10 ml10"></div>
|
||||
<!--<a remote="true" href="javascript:void(0)" class="blue_btn fl" style="margin-left: 80px;margin-bottom: 10px;margin-top: -10px;" onclick="$('#issue-form').submit();">-->
|
||||
<!--<%#= l(:button_submit) %>-->
|
||||
<!--</a>-->
|
||||
</div>
|
||||
|
||||
<% end %><!--end-->
|
||||
|
||||
<!--<fieldset><legend><%#= l(:field_notes) %></legend>-->
|
||||
<!--回复框-->
|
||||
<% if @journals.present? %>
|
||||
<div id="history">
|
||||
<%= render :partial => 'history', :locals => {:issue => @issue, :journals => @journals} %>
|
||||
|
|
Loading…
Reference in New Issue