#11418 closed enhancement (fixed)
set_owner_to_self should use author field of form
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.3 |
Component: | ticket system | Version: | |
Severity: | normal | Keywords: | workflow |
Cc: | Branch: | ||
Release Notes: |
The user email and name of an unauthenticated session are used to populate the new ticket owner field in the |
||
API Changes: | |||
Internal Changes: |
Description
When changing a ticket the author field is populated from prefs, that author field value can be replaced by the user, and the value of the author field is used as the ticket change author. However, when accepting a ticket, the set_owner_to_self
action does not use the author field when consider who the ticket should be assigned to.
The following patch has been lightly tested, but may be a starting point in aligning the behavior of the workflow with the rest of the ticket form.
-
trac/ticket/default_workflow.py
diff --git a/trac/ticket/default_workflow.py b/trac/ticket/default_workflow.py index 952437a..52d1a63 100644
a b from trac.env import IEnvironmentSetupParticipant 29 29 from trac.perm import PermissionSystem 30 30 from trac.ticket.api import ITicketActionController, TicketSystem 31 31 from trac.ticket.model import Resolution 32 from trac.util import get_reporter_id 32 33 from trac.util.text import obfuscate_email_address 33 34 from trac.util.translation import _, tag_, cleandoc_ 34 35 from trac.web.chrome import Chrome, add_script, add_script_data … … Read TracWorkflow for more information (don't forget to 'w 285 286 "%(current_owner)s to the selected user", 286 287 current_owner=current_owner)) 287 288 elif 'set_owner_to_self' in operations and \ 288 ticket._old.get('owner', ticket['owner']) != req.authname: 289 ticket._old.get('owner', ticket['owner']) != \ 290 get_reporter_id(req, 'author'): 289 291 hints.append(_("The owner will be changed from %(current_owner)s " 290 292 "to %(authname)s", current_owner=current_owner, 291 authname= req.authname))293 authname=get_reporter_id(req, 'author'))) 292 294 if 'set_resolution' in operations: 293 295 if 'set_resolution' in this_action: 294 296 resolutions = [x.strip() for x in … … Read TracWorkflow for more information (don't forget to 'wik 364 366 newowner = newowner[0] 365 367 updated['owner'] = newowner 366 368 elif operation == 'set_owner_to_self': 367 updated['owner'] = req.authname369 updated['owner'] = get_reporter_id(req, 'author') 368 370 elif operation == 'del_resolution': 369 371 updated['resolution'] = '' 370 372 elif operation == 'set_resolution':
Attachments (0)
Change History (10)
comment:1 by , 11 years ago
Summary: | set_owner_to_self should use author from form or prefs → set_owner_to_self should use author field of form |
---|
comment:2 by , 11 years ago
Keywords: | workflow added |
---|---|
Milestone: | → next-major-releases |
comment:4 by , 10 years ago
Milestone: | next-major-releases → 1.1.3 |
---|
comment:5 by , 10 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:6 by , 10 years ago
Replying to rjollos:
The
*args, **kwargs
in the initializer signature trunk/trac/ticket/default_workflow.py@13056:119#L101 seems to be an artifact of earlier implementation in whichComponent.__init__
was executed in the constructor: [5441]. I propose to remove the arguments on the trunk.
Removed in [13172].
comment:7 by , 10 years ago
Milestone: | 1.1.3 → 1.0.3 |
---|
One additional issue can be fixed in this ticket: when [ticket] restrict_owner = false
and an unauthenticated user with name and email set for the session, the name and email should be used to populate the input in the set_owner
operation, rather than anonymous.
comment:8 by , 10 years ago
Release Notes: | modified (diff) |
---|
Committed to 1.0-stable in [13215:13216], merged to trunk in [13217:13219].
In log:rjollos.git:t11418 I tried adding some unit testing, but they seemed rather klunky and contrived. Testing with functional tests continues to prove challenging because of the shared state of the environment between tests. The ideal fix could be a new functional test framework that makes the tests easier to write and allows tests to be written so that they don't share state (though the latter could possibly be done independent of the former).
comment:9 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The
*args, **kwargs
in the initializer signature trunk/trac/ticket/default_workflow.py@13056:119#L101 seems to be an artifact of earlier implementation in whichComponent.__init__
was executed in the constructor: [5441]. I propose to remove the arguments on the trunk.The only case I see on trac-hacks.org in which
ConfigurableTicketWorkflow
is instantiated in a plugin is th:AdvancedTicketWorkflowPlugin - th:browser:/advancedticketworkflowplugin/0.12/advancedworkflow/controller.py@9962:35#L22. The proposed change would not affect th:AdvancedWorkflowPlugin.