Opened 15 years ago
Last modified 8 years ago
#6033 new enhancement
[Patch] tf.who should be passed through format_author
Reported by: | Matt Caron | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | TracFormsPlugin |
Severity: | normal | Keywords: | user name format display |
Cc: | Trac Release: | 0.11 |
Description
When you have a "who" it would be nice to run that through format_author... especially if you've patched format_author to show the full name. ;-)
Patch attached.
Attachments (1)
Change History (13)
Changed 15 years ago by
Attachment: | format_author.patch added |
---|
comment:1 Changed 14 years ago by
Summary: | tf.who should be opassed through format_author → [Patch] tf.who should be passed through format_author |
---|
comment:2 follow-up: 4 Changed 14 years ago by
Keywords: | user name format display added |
---|---|
Owner: | changed from Rich Harkins to Steffen Hoffmann |
Replying to mattc:
When you have a "who" it would be nice to run that through format_author... especially if you've patched format_author to show the full name. ;-)
Sorry for the long time of support missing from here. Now I'm interested to bring this into trunk
soon. Could I find that mod for format_author
somewhere too?
comment:3 follow-up: 5 Changed 14 years ago by
It took a while, until I actually looked into trac.web.chrome today, to understand the possibilities of that. But wait - the most relevant improvement, processing email addresses (with optional obfuscation) is not relevant here, as long as user<>email, right?
It's still nice to know where to start an improvement. But the problem is still how to get the full name without patching Trac directly (and consequently future versions over-and-over again), and I'll consider this incomplete, until this has been solved. Most likely copying Chrome
from trac.web.chrome and adding what otherwise as to be patched to Trac is the way to go. Or (better) add that method to AccountManagerPlugin to make re-using it easier/more likely.
comment:4 Changed 14 years ago by
Replying to hasienda:
Replying to mattc:
When you have a "who" it would be nice to run that through format_author... especially if you've patched format_author to show the full name. ;-)
Sorry for the long time of support missing from here. Now I'm interested to bring this into
trunk
soon. Could I find that mod forformat_author
somewhere too?
I had forgotten that I owed you this patch. I will try to get to it today.
comment:5 Changed 14 years ago by
Replying to hasienda:
It took a while, until I actually looked into trac.web.chrome today, to understand the possibilities of that. But wait - the most relevant improvement, processing email addresses (with optional obfuscation) is not relevant here, as long as user<>email, right?
Yes. This is only helpful if != email. The way we run it, everyone has a username (say, like "matt") and this is mapped to the full name you can put in in the preferences.
It's still nice to know where to start an improvement. But the problem is still how to get the full name without patching Trac directly (and consequently future versions over-and-over again), and I'll consider this incomplete, until this has been solved.
I solved it by tracking upstream Trac in git so I just merge in upstream changes to my code, fix conflicts and redeploy.
comment:6 Changed 14 years ago by
Status: | new → assigned |
---|
There are a lot more occurrences of usernames after adding form view, so I'll look into this again and apply an extended patch even if there's no immediately profit for most applications where username != email.
comment:7 Changed 14 years ago by
Just to confirm, that this is WiP:
But as I expected there is considerably more related work to be done. format_author()
requires user information do any mapping. And sadly this is env.get_known_users()
seems like a weak spot. It queries the Trac db again and again with a double JOIN LEFT, so this is quite costly with a large user base. So I went on to
- make it configurable (default = disabled) for backwards compatibility too
- add an optional user data cache to reduce the burden on the db, but this is feature is available only for Trac >= 0.12
A good thing about it: The functionality will be available _without_ patching Trac core. Thoughts?
comment:8 Changed 14 years ago by
(In [10227]) TracFormsPlugin: Introduce a custom format_author()
, refs #6033.
It adds not only email address obfuscation but configurable full username
display too. To enable this in all content provided by TracForms
you'll need to add a dedicated configuration to your trac.ini
as follows:
[forms] show_fullname = true show_fullname_position = change,macro,value
Caching the query done in env.get_known_users() is really nice, only the CacheManager is available since Trac revision 8071 (0.12dev). So this is kept optional to maintain compatibility with Trac < 0.12 .
comment:9 Changed 13 years ago by
No in-depended test feedback by now? This is a bit disappointing. Come-on, let's try it!
comment:10 Changed 12 years ago by
My own Trac applications provided plenty of opportunities for testing this, working fine.
comment:11 Changed 8 years ago by
Status: | assigned → new |
---|
comment:12 Changed 8 years ago by
Owner: | Steffen Hoffmann deleted |
---|
Patch to macros.py to run the who through format_author.