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