#8360 closed enhancement (fixed)
[PATCH] Use updater's name and email in ticket notifications
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
Attachments (2)
Change History (18)
by , 16 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 , 14 years ago
Cc: | added |
---|---|
Keywords: | patch added |
follow-up: 6 comment:3 by , 14 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 , 14 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 , 14 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 , 14 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 , 14 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 , 14 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 , 14 years ago
comment:9 by , 14 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 , 14 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Documentation updated in 0.13/TracNotification@2.
follow-ups: 12 13 15 comment:11 by , 13 years ago
Cc: | added |
---|
Maybe I've missed something in my reading of this ticket, but I think I see a few issues with the current solution:
- With the "improvement" mentioned in 9, it would be possible for a malefactor to:
- Attached to a Trac system which allows anonymous users to add or comment to tickets and uses this feature.
- Use the Preferences to set an email address to someone else's email address and name, the fall-guy.
- Enter a inappropriate comment and/or new ticket.
- The Trac system would then send inappropriate emails that would appear to have come from the fall-guy.
- Many SMTP servers are configured in such a way that they will refuse any message with a
From:
field not being the same as the authenticated user (i.e.smtp_from
!=smtp_user
). If one has such an SMTP server, one cannot utilize this new feature.
Suggestion: Additionally allow, which could be used instead:- Setting the
Reply-To:
field to the change author. - Adding the author to the from-name. e.g. User
Ford
makes a change to a ticket in the HHGTrac system from Megadodo Publications. This results in emails with a from line something like:From: Ford via HHGTrac <trac@megadodo.com>
- Setting the
comment:12 by , 13 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Since I commented on this ticket with issues I feel should be addressed or at least acknowledge by a Trac authority, I am reopening this ticket. If the powers that be do not think these issues need further examination, feel free to just re-close. Just wanted to make sure that someone of authority thought about these issues and that they weren't just overlooked in the noise.
follow-up: 16 comment:13 by , 13 years ago
Replying to mpotter@…:
- With the "improvement" mentioned in 9, it would be possible for a malefactor to:
Yes, that is correct. Given that it's trivial to send emails impersonating someone else, I don't think this is actually a problem. And the feature should probably not be enabled for externally-facing Trac instances that allow anonymous posting. It's disabled by default.
Suggestion: Additionally allow, which could be used instead:
- Setting the
Reply-To:
field to the change author.- Adding the author to the from-name. e.g. User
Ford
makes a change to a ticket in the HHGTrac system from Megadodo Publications. This results in emails with a from line something like:
From: Ford via HHGTrac <trac@megadodo.com>
Those sound like good ideas. Unfortunately, our notification subsystem is in a relatively sorry state, and adding the features would make the situation even worse. We were hoping for the integration of the th:AnnouncerPlugin to give a new breath to that part, allowing to more easily customize notifications and how they are sent, but that effort seems to have stalled.
I'm closing this again, as the initial feature request was implemented. Could you please file a new ticket with your suggestions? Thanks.
comment:15 by , 13 years ago
Replying to rblank:
Could you please file a new ticket with your suggestions? Thanks.
Filed new ticket #10579 to cover the first issue (do not use "anonymous" email addresses).
Filed new ticket #10578 to cover the first bullet of the second issue (changing the ReplyTo:
field). Left off the second bullet (changing the From:
name) for negative comments on this had been made before which I can agree with, but some may disagree. Conversations can be take there.
comment:16 by , 12 years ago
Replying to rblank:
Replying to mpotter@…:
Suggestion: Additionally allow, which could be used instead:
- Setting the
Reply-To:
field to the change author.- Adding the author to the from-name. e.g. User
Ford
makes a change to a ticket in the HHGTrac system from Megadodo Publications. This results in emails with a from line something like:
From: Ford via HHGTrac <trac@megadodo.com>
Those sound like good ideas. Unfortunately, our notification subsystem is in a relatively sorry state, and adding the features would make the situation even worse. We were hoping for the integration of the th:AnnouncerPlugin to give a new breath to that part, allowing to more easily customize notifications and how they are sent, but that effort seems to have stalled.
Right, I've been one of the supporters of the proposal. Only I've got distracted by other Trac plugin projects for a while. Please note, that th:AnnouncerPlugin development as just continued, and I foresee that we'll follow-up on the original proposal in due time as well.
I'll think about using the preliminary state from TracNotification regarding this feature and preparing a more competing feature for AnnouncerPlugin along the lines of #10578. Please consider to follow-up on th:#10613 with comments.
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.