Tíquete #21224

チケットメールのタイトルに更新者の名前を表示

: 2010-03-29 10:11 Última Atualização: 2010-05-20 21:07

Relator:
(del#42389)
Dono:
Estado:
Fechado
Componente:
(Nenhum)
Marcos:
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Nenhum
Arquivo:
Nenhum

Details

メールのタイトルを見るだけで更新者がわかるように、タイトルの横に更新者の名前を出してもらえたらと思います。

Ticket History (3/6 Histories)

2010-03-29 10:11 Updated by: (del#42389)
  • New Ticket "チケットメールのタイトルに更新者の名前を表示" created
2010-03-31 20:51 Updated by: jun66j5
Comentário

trac.ini で

[notification]
ticket_subject_template = $prefix #$ticket.id: [$ticket.owner] $summary
みたいのを設定すると subject に担当者が入るようになりますが、更新者を入れようとすると Trac 本体を修正しないとできないですね。

とりあえず Trac 本体に ↓ のパッチを当てて

--- trac/ticket/notification.py.orig 2010-03-31 20:46:00.601875000 +0900
+++ trac/ticket/notification.py      2010-03-31 20:46:42.960769800 +0900
@@ -133,7 +133,7 @@
         self.ticket['new'] = self.newticket
         self.ticket['link'] = link

-        subject = self.format_subj(summary)
+        subject = self.format_subj(summary, change_data)
         if not self.newticket:
             subject = 'Re: ' + subject
         self.data.update({
@@ -204,7 +204,7 @@
         return '#%s: %s' % (self.ticket.id, wrap(self.ticket['summary'],
                                                  self.COLS, linesep=CRLF))

-    def format_subj(self, summary):
+    def format_subj(self, summary, change):
         template = self.config.get('notification','ticket_subject_template')
         template = TextTemplate(template.encode('utf8'))

@@ -216,6 +216,7 @@
             'prefix': prefix,
             'summary': summary,
             'ticket': self.ticket,
+            'change': change,
             'env': self.env,
         }
ticket_subject_template を以下のような感じに設定すれば更新者が入るかと思います。
[notification]
ticket_subject_template = $prefix #$ticket.id: [$change.author] $summary

2010-04-06 08:35 Updated by: okamototk
Comentário

Oかもとです。お疲れ様です。

上記のパッチだと、新規のチケットでauthorが入らずエラーになってしまうので、新規チケットの場合はreporterを追加するようにしてみました。

+++ notification.py     2010-04-05 12:32:38.000000000 +0900
@@ -133,14 +133,16 @@
                         changes_body += '  * %s:  %s%s' % (field, chg, CRLF)
                     if newv:
                         change_data[field] = {'oldvalue': old, 'newvalue': new}
-
+        else:
+            change_data.update({'author': ticket.values['reporter']})
+
         self.ticket['description'] = wrap(
             self.ticket.values.get('description', ''), self.COLS,
             initial_indent=' ', subsequent_indent=' ', linesep=CRLF)
         self.ticket['new'] = self.newticket
         self.ticket['link'] = link

-        subject = self.format_subj(summary)                                   
+        subject = self.format_subj(summary, change_data)
         if not self.newticket:
             subject = 'Re: ' + subject                                        
         self.data.update({
@@ -204,7 +204,7 @@
         return '#%s: %s' % (self.ticket.id, wrap(self.ticket['summary'],
                                                  self.COLS, linesep=CRLF))

-    def format_subj(self, summary):
+    def format_subj(self, summary, change):
         template = self.config.get('notification','ticket_subject_template')
         template = TextTemplate(template.encode('utf8'))

@@ -216,6 +216,7 @@
             'prefix': prefix,
             'summary': summary,
             'ticket': self.ticket,
+            'change': change,
             'env': self.env,
         }
2010-04-07 07:24 Updated by: okamototk
  • Dono Update from (Nenhum) to okamototk
Comentário

TracLightning2.5.0alpha4で対応しました。ご確認ください。

2010-04-19 16:56 Updated by: okamototk
2010-05-20 21:07 Updated by: okamototk
  • Estado Update from Aberto to Fechado
  • Ticket Close date is changed to 2010-05-20 21:07

Attachment File List

No attachments

Editar

Please login to add comment to this ticket » Login