Edgewall Software
Modify

Opened 9 years ago

Last modified 3 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
Release Notes:
API 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 Changed 9 years ago by anonymous

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

comment:2 Changed 9 years ago by mitar

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:3 Changed 9 years ago by cboos <cboos@…>

Milestone: next-minor-0.12.x

Patch welcomed.

comment:4 Changed 8 years ago by exarkun@…

Cc: exarkun@… added

comment:5 Changed 8 years ago by anonymous

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 Changed 8 years ago by mitar

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.

comment:7 Changed 8 years ago by mitar

Patch for this one-line change?

comment:8 Changed 8 years ago by exarkun@…

Any hints on where the unit tests for the cc manipulation code are?

comment:9 in reply to:  5 ; Changed 8 years ago by Christian Boos

Keywords: cc user email added
Milestone: next-minor-0.12.xnext-major-0.1X
Priority: normallow

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.

comment:10 in reply to:  9 ; Changed 8 years ago by Mitar

Replying to cboos:

session data is purged after a while.

Even for registered users? Is there a way to disable/configure this?

comment:11 in reply to:  10 Changed 8 years ago by Christian Boos

Replying to Mitar:

Replying to cboos:

session data is purged after a while.

Even for registered users?

No, you're right, the session is only purged for non authenticated users. So we could indeed already prefer the user name for authenticated users.

comment:12 Changed 8 years ago by Mitar

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 Changed 8 years ago by Mitar

If it is not visible: it is just necessary to change 0 index to -1 index.

comment:14 Changed 6 years ago by bill_b <bill@…>

Cc: bill@… added

Any chance of this getting into the system soon? Thanks.

comment:15 Changed 6 years ago by Mitar

I made a plugin for this.

comment:16 in reply to:  15 Changed 6 years ago by bill_b <bill@…>

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 Changed 4 years ago by holger-juergs@…

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  
    647647        of CC status for this user relative to the current `cc_list`."""
    648648        entries = []
    649649        email = req.session.get('email', '').strip()
    650         if email:
    651             entries.append(email)
     650#        if email:
     651#            entries.append(email)
    652652        if req.authname != 'anonymous':
    653653            entries.append(req.authname)
     654        elif email:
     655            entries.append(email)
    654656        else:
    655657            author = get_reporter_id(req, 'author').strip()
    656658            if author and author != 'anonymous':

perhaps there will be some side-effects…

comment:18 Changed 3 years ago by Ryan J Ollos

Cc: Ryan J Ollos added

comment:19 Changed 3 years ago by figaro

Keywords: patch added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set.
The owner will be changed from (none) to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.