Edgewall Software
Modify

Opened 10 years ago

Closed 10 years ago

#11699 closed enhancement (fixed)

Use Chrome.authorinfo in render_ticket_action_controller

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.1.3
Component: ticket system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

The usernames in the default workflow hints are wrapped in spans with class trac-author, trac-author-anonymous or trac-author-none.

API Changes:
  • The final character in the string returned from separated() in trac.util.presentation can be specified through the last parameter, which defaults to None.
  • Chrome.authorinfo() returns a span with class trac-author-anonymous and trac-author-none when the author input is anonymous and None, respectively.
  • Chrome.format_author() returns (none) for any author input that is falsy.
Internal Changes:

Description (last modified by Ryan J Ollos)

In #11689 / [13000] Chrome(self.env).format_author was utilized so that anonymous is translated. The changes were committed to 1.0-stable. However, on the trunk we can utilize Chrome(self.env).authorinfo so that the author is wrapped in a span with class trac-author (#11145).

See also #11474 in which fine-grained permission checks will be properly implemented for format_author and authorinfo.

Attachments (0)

Change History (8)

comment:1 by Ryan J Ollos, 10 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 10 years ago

Description: modified (diff)

comment:3 by Ryan J Ollos, 10 years ago

An open question is whether (none) and anonymous should be wrapped in a span with class trac-author. Changes in log:rjollos.git:t11699.

comment:4 by Jun Omae, 10 years ago

I think it would be good to wrap with trac-author-anonymous/trac-author-none rather than trac-author to determine wheter username is an existent user, anonymous or (none). Thoughts?

comment:5 by Ryan J Ollos, 10 years ago

The additional two classes seem like a good idea. I added some changes in log:rjollos.git:t11699. With these changes anonymous will have the class trac-author-anonymous. The change for (none) might be a bit more complicated.

A special case in Chrome.authorinfo for author having the value (none) seems a bit ugly. It seems like it would be better if Chrome.authorinfo returned <span author="trac-author-none">(none)</span> when None or the empty string is passed for author. With that change the default_workflow wouldn't have to worry about handling the special case either: trunk/trac/ticket/default_workflow.py@13056:236,292#L227. The code in default_workflow would be simpler:

-formatted_current_owner = format_author(current_owner or _("(none)"))
+formatted_current_owner = format_author(current_owner)

However, currently Chrome.authorinfo returns anonymous when author is None or an empty string. I haven't look closely at what the consequence throughout Trac might be for changing the behavior of Chrome.authorinfo. I plan to do that next though.

comment:6 by Ryan J Ollos, 10 years ago

Status: newassigned

in reply to:  5 comment:7 by Ryan J Ollos, 10 years ago

Replying to rjollos:

However, currently Chrome.authorinfo returns anonymous when author is None or an empty string. I haven't look closely at what the consequence throughout Trac might be for changing the behavior of Chrome.authorinfo. I plan to do that next though.

I think this change is okay. The result is an API change, but it should only affect cases in which None or the empty string are passed in the code to Chrome.authorinfo. The value of req.authname should never be None or the empty string. From what I can see, req.authname will always be a username or anonymous: trunk/trac/web/main.py@13117:147-149#L134.

Latest changes in log:rjollos.git:t11699.1.

comment:8 by Ryan J Ollos, 10 years ago

API Changes: modified (diff)
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to trunk in [13202:13203].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


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