新增、修改缺陷发送邮件的缺陷编写优化
This commit is contained in:
parent
beeb707347
commit
0471446ac8
|
@ -1163,8 +1163,11 @@ class Issue < ActiveRecord::Base
|
|||
else
|
||||
issue_index = 1
|
||||
self.project.issues.each do |issue|
|
||||
if self.id > issue.id
|
||||
++issue_index
|
||||
if self.id == nil
|
||||
issue_index = self.project.issues.count +1
|
||||
break
|
||||
elsif self.id > issue.id
|
||||
issue_index = issue_index+1
|
||||
end
|
||||
end
|
||||
issue_index.to_s
|
||||
|
|
|
@ -119,8 +119,9 @@ class Mailer < ActionMailer::Base
|
|||
# Mailer.issue_edit(journal).deliver => sends an email to issue recipients
|
||||
def issue_edit(journal)
|
||||
issue = journal.journalized.reload
|
||||
issue_id = issue.project_index
|
||||
redmine_headers 'Project' => issue.project.identifier,
|
||||
'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s,
|
||||
'Issue-Id' => issue_id.to_s,
|
||||
'Issue-Author' => issue.author.login
|
||||
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||
message_id journal
|
||||
|
@ -129,7 +130,7 @@ class Mailer < ActionMailer::Base
|
|||
recipients = journal.recipients
|
||||
# Watchers in cc
|
||||
cc = journal.watcher_recipients - recipients
|
||||
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] "
|
||||
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
|
||||
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
|
||||
s << issue.subject
|
||||
@issue = issue
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => h(@journal.user)) %>
|
||||
<%= l(:text_issue_updated, :id => "##{@issue.project_index}", :author => h(@journal.user)) %>
|
||||
|
||||
<ul>
|
||||
<% details_to_strings(@journal.details, false, :only_path => false).each do |string| %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => @journal.user) %>
|
||||
<%= l(:text_issue_updated, :id => "##{@issue.project_index}", :author => @journal.user) %>
|
||||
|
||||
<% details_to_strings(@journal.details, true).each do |string| -%>
|
||||
<%= string %>
|
||||
|
|
Loading…
Reference in New Issue