#8360 closed enhancement (fixed)
[PATCH] Use updater's name and email in ticket notifications — at Version 10
Reported by: | Owned by: | Remy Blank | |
---|---|---|---|
Priority: | high | Milestone: | 1.0 |
Component: | notification | Version: | 0.11-stable |
Severity: | normal | Keywords: | updater notification from consider patch |
Cc: | Thijs Triemstra, mpotter@… | Branch: | |
Release Notes: |
notification: Allow using the author of a change as the |
||
API Changes: | |||
Internal Changes: |
Description
This patch adds a new boolean config option named 'smtp_from_smart'. When this option is set to true notifications use updater's name and email for their 'From:' message header. We find it very useful since this patch helps to easily see who was modifying a ticket in a list of messages. Also, it's now possible to reply to the person directly.
The patch was created by (GalaxyMaster) from Openwall Project
This work was sponsored by CivicActions LLC
Change History (12)
by , 15 years ago
Attachment: | trac-0.11.4-gm-smtp_from_smart.diff added |
---|
comment:1 by , 15 years ago
Keywords: | consider added |
---|---|
Milestone: | → 0.13 |
comment:2 by , 13 years ago
Cc: | added |
---|---|
Keywords: | patch added |
follow-up: 6 comment:3 by , 13 years ago
Here's an updated patch that re-uses the stmp_from_name
and applies the updater's name when it's passed the value __updater__
.
-
trac/ticket/notification.py
85 85 changes_body = '' 86 86 self.reporter = '' 87 87 self.owner = '' 88 self.updater = '' 88 89 changes_descr = '' 89 90 change_data = {} 90 91 link = self.env.abs_href.ticket(ticket.id) … … 329 330 for updater, in cursor: 330 331 break 331 332 333 self.updater = updater 332 334 if not notify_updater: 333 335 filter_out = True 334 336 if notify_reporter and (updater == self.reporter): -
trac/notification.py
276 276 self._init_pref_encoding() 277 277 domains = self.env.config.get('notification', 'ignore_domains', '') 278 278 self._ignore_domains = [x.strip() for x in domains.lower().split(',')] 279 # Get the email addresses of all known users279 # Get the names and email addresses of all known users 280 280 self.email_map = {} 281 self.name_map = {} 281 282 for username, name, email in self.env.get_known_users(self.db): 283 if name: 284 self.name_map[username] = name 282 285 if email: 283 286 self.email_map[username] = email 284 287 … … 404 407 reactivate(t) 405 408 projname = self.env.project_name 406 409 public_cc = self.config.getbool('notification', 'use_public_cc') 410 411 if self.from_name == '__updater__' and self.updater: 412 name = self.updater 413 if self.updater in self.name_map: 414 name = self.name_map[self.updater] 415 self.from_name = name 416 417 if self.updater in self.email_map: 418 self.from_email = self.email_map[self.updater] 419 407 420 headers = {} 408 421 headers['X-Mailer'] = 'Trac %s, by Edgewall Software' % __version__ 409 422 headers['X-Trac-Version'] = __version__
I'll add a new patch with documentation if it gets accepted.
comment:4 by , 13 years ago
The patch on #6512 seems to do almost the same, except it uses the username instead of the name specified in the preferences panel.
comment:5 by , 13 years ago
Milestone: | next-major-0.1X → 0.13 |
---|---|
Owner: | changed from | to
Priority: | normal → high |
Putting on my todo list for review. The patch in #6512 looks simpler at first sight, but I'll review both properly.
comment:6 by , 13 years ago
Replying to thijstriemstra:
Here's an updated patch that re-uses the
stmp_from_name
and applies the updater's name when it's passed the value__updater__
.
I think you miss one feature I introduced in the original patch — it also uses {{smtp_from_name}}, but it appends it to updater's name, e.g. if {{smtp_from_name}} was configured to be '[via Trac]' and updater is "Happy Joe", then the resulting From in my patch will be '"Happy Joe [via Trac]" <happy.joe@…'.
The rationale for this is that people are not happy to see an automated messages which they didn't write, but with the addition of, say, '[via Trac]' it's clear that the message was generated on their behalf. Also, it's much easier to filter/search for these messages.
by , 13 years ago
Attachment: | 8360-smtp-from-author-r10410.patch added |
---|
Use the change author as a sender if [notifiation] smtp_from_author
is true
.
comment:7 by , 13 years ago
8360-smtp-from-author-r10410.patch is a slightly more complete version of the patch in comment:3, with the following changes:
- It uses a separate boolean option
[notifiation] smtp_from_author
to enable the functionality, so thatsmtp_from
andsmtp_from_name
can still be set independently. The latter two are used if the author of a change hasn't configured an e-mail address. - It adds a test case for the new behavior.
I didn't keep the suggested "misuse" of smtp_from_name
as a name suffix. Sure, the author of a change didn't write the notification e-mail, but she did make the change, so sending in her name feels acceptable. And filtering is better done with other headers (e.g. X-Trac-Project
).
Feedback and testing welcome.
comment:8 by , 13 years ago
comment:9 by , 13 years ago
An improved patch that also handles anonymous users having defined a name and an e-mail address was applied in [10421].
comment:10 by , 13 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Documentation updated in 0.13/TracNotification@2.
I'm not such a fan of the
smtp_from_smart
name, but I like the feature, even though I wonder if it's not possible already. If not, let's raise the priority of this ticket.