From 0471446ac8ebe846dcd7e6666e9d093696a94bb0 Mon Sep 17 00:00:00 2001 From: nwb Date: Mon, 7 Jul 2014 10:07:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E3=80=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E7=BC=96=E5=86=99=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/issue.rb | 7 +++++-- app/models/mailer.rb | 5 +++-- app/views/mailer/issue_edit.html.erb | 2 +- app/views/mailer/issue_edit.text.erb | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index f8837cb6e..550e0dc5d 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -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 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 25d592a24..ef4996eac 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -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 diff --git a/app/views/mailer/issue_edit.html.erb b/app/views/mailer/issue_edit.html.erb index 720cfea69..be7076cb6 100644 --- a/app/views/mailer/issue_edit.html.erb +++ b/app/views/mailer/issue_edit.html.erb @@ -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)) %>