Opened 15 years ago
Last modified 9 years ago
#8681 new enhancement
[PATCH] Allow adding usernames to a ticket CC list
Reported by: | Mitar | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | next-major-releases |
Component: | ticket system | Version: | 0.11.4 |
Severity: | normal | Keywords: | patch cc user email |
Cc: | mmitar@…, exarkun@…, bill@…, Ryan J Ollos | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Allow adding usernames to a ticket CC list instead of e-mail addresses for users which can only select checkbox to add themselves to the CC list (and thus cannot control content). For our setup it would be enough to just add a project-wide configuration switch which would tell Trac whether to prefer usernames or e-mail addresses.
Attachments (0)
Change History (19)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
That is so only because your username does not have e-mail address set up in Trac. In _toggle_cc
method there is this code:
entries = [] email = req.session.get('email', '').strip() if email: entries.append(email) if req.authname != 'anonymous': entries.append(req.authname) ... if remove: action, entry = ('remove', remove[0]) elif add: action, entry = ('add', add[0]) return (action, entry, cc_list)
So it uses e-mail address if there is one or username. If I change last lines to:
if remove: action, entry = ('remove', remove[0]) elif add: action, entry = ('add', add[-1]) return (action, entry, cc_list)
it prefers username.
comment:4 by , 15 years ago
Cc: | added |
---|
follow-up: 9 comment:5 by , 15 years ago
Should it ever prefer email address? Usernames are more robust (that is, less likely to change). Plus, adding email addresses means more places for spammers to scrape information from. Also, querying for tickets a user is CC'd on becomes harder, because they might have to search for multiple values.
comment:6 by , 15 years ago
I agree. Especially because Trac does not support multiple owners of the ticket. So if multiple persons are working on a ticket they are often listed in CC field. So usernames are also preferred in this case.
follow-up: 10 comment:9 by , 14 years ago
Keywords: | cc user email added |
---|---|
Milestone: | next-minor-0.12.x → next-major-0.1X |
Priority: | normal → low |
Replying to anonymous:
Should it ever prefer email address? Usernames are more robust (that is, less likely to change)
The idea was that you should better grab an e-mail address when you have one, session data is purged after a while.
In later iterations of the notification subsystem, if the e-mail addresses are stored differently, maybe this could be changed.
follow-up: 11 comment:10 by , 14 years ago
Replying to cboos:
session data is purged after a while.
Even for registered users? Is there a way to disable/configure this?
comment:11 by , 14 years ago
comment:12 by , 14 years ago
I am using on a production Trac system above changes and it works well. So only that small change is necessary to prefer usernames before e-mail address. But probably this should be configurable so there is need for some additional code.
comment:13 by , 14 years ago
If it is not visible: it is just necessary to change 0 index to -1 index.
comment:16 by , 12 years ago
Replying to Mitar:
I made a plugin for this.
Thanks - especially for the quick response. That seems to work well. This does seem like a simple enough and desirable feature to have integrated in, but this works for now.
comment:17 by , 10 years ago
Summary: | Allow adding usernames to a ticket CC list → [PATCH] Allow adding usernames to a ticket CC list |
---|
using the following PATCH of web_ui.py (under 0.12) solves the problem for me with permission of PrivateTicketsPlugin (#th11862)
-
web_ui.py
old new 647 647 of CC status for this user relative to the current `cc_list`.""" 648 648 entries = [] 649 649 email = req.session.get('email', '').strip() 650 if email:651 entries.append(email)650 # if email: 651 # entries.append(email) 652 652 if req.authname != 'anonymous': 653 653 entries.append(req.authname) 654 elif email: 655 entries.append(email) 654 656 else: 655 657 author = get_reporter_id(req, 'author').strip() 656 658 if author and author != 'anonymous':
perhaps there will be some side-effects…
comment:18 by , 10 years ago
Cc: | added |
---|
comment:19 by , 9 years ago
Keywords: | patch added |
---|
This already seems to be working in trac at http://sourceforge.net/apps/trac shows it as:
Add to Cc: myusername [ ]
and
Remove from Cc: myusername [ ]
when editing a ticket.
Not sure how to configure it though.
stefan