#13013 closed defect (fixed)
ConfigurableTicketWorkflow should not handle other operations
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.17 |
Component: | ticket system | Version: | |
Severity: | normal | Keywords: | workflow |
Cc: | Branch: | ||
Release Notes: |
|
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Issue reproduced by the following steps:
- Enable CodeReviewActionController
- Put ticket in
review
state
The user that requested the review doesn't have permission to review the ticket, but sees:
The user should see:
Attachments (2)
Change History (12)
by , 7 years ago
Attachment: | Screen Shot 2018-04-21 at 12.03.41.png added |
---|
by , 7 years ago
Attachment: | Screen Shot 2018-04-21 at 12.04.02.png added |
---|
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 7 years ago
Release Notes: | modified (diff) |
---|
comment:4 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:5 by , 6 years ago
th:#13484 resulted from these changes. Previously ConfigurableTicketWorkflow
would be invoked for every action and status changes would be applied. After r16551, each ITicketActionController
needs to apply status changes.
I'm considering modifying each controller implemented in AdvancedTicketWorkflow, with a change like the following for TicketWorkflowOpOwnerReporter
:
-
advancedworkflow/controller.py
98 98 def _format_author(self, req, author): 99 99 return Chrome(self.env).format_author(req, author) 100 100 101 def _get_new_status(self, action): 102 actions = self.get_configurable_workflow().actions 103 return actions[action]['newstate'] 104 101 105 102 106 class TicketWorkflowOpOwnerReporter(TicketWorkflowOpBase): 103 107 """Sets the owner to the reporter of the ticket. … … 127 131 128 132 def get_ticket_changes(self, req, ticket, action): 129 133 """Returns the change of owner.""" 130 return {'owner': ticket['reporter']} 134 return { 135 'owner': ticket['reporter'], 136 'status': self._get_new_status(action), 137 } 131 138 132 139 133 140 class TicketWorkflowOpOwnerComponent(TicketWorkflowOpBase):
follow-up: 7 comment:6 by , 6 years ago
To be clear about comment:5, I don't think the changes in r16551 are wrong. For a plugin like AdvancedTicketWorkflowPlugin it might be useful to have a way to add operations that use behaviors of ConfigurableTicketWorklow
like implicit status change. I haven't taken the time to investigate, so I'm not sure exactly what form that takes, whether it's a base class or helper methods on the ConfigurableTicketWorklow
component.
follow-up: 8 comment:7 by , 6 years ago
Replying to Ryan J Ollos:
To be clear about comment:5, I don't think the changes in r16551 are wrong.
Reconsidering…
[ticket] workflow
option normally accepts one or more of workflow controllers. If one of the controllers sets new status to a ticket, which of the controllers should set the status? All controllers should set? At least, I think that other controllers expect ConfigurableTicketWorkflow
sets new status to a ticket even if the operation is not defined in the ConfigurableTicketWorkflow
.
It might be good that the setting status should be ideally moved to TicketModule
from ConfigurableTicketWorkflow
.
comment:8 by , 6 years ago
Replying to Jun Omae:
[ticket] workflow
option normally accepts one or more of workflow controllers. If one of the controllers sets new status to a ticket, which of the controllers should set the status? All controllers should set? At least, I think that other controllers expectConfigurableTicketWorkflow
sets new status to a ticket even if the operation is not defined in theConfigurableTicketWorkflow
.It might be good that the setting status should be ideally moved to
TicketModule
fromConfigurableTicketWorkflow
.
I've been considering that the status change behavior in ConfigurableTicketWorkflow
might need to be an explicit operation, e.g. set_status
.
CodeReviewActionController
presents a complicated case in which the status is determined by an algorithm in the controller. CodeReviewActionController
wants to change the status using behavior different from ConfigurableTicketWorkflow
's implicit "set_status
" operation.
With set_status
operation made explicit in ConfigurableTicketWorkflow
, actions that rely on existing behavior could have the set_status
operation added to operations
in trac.ini. Operations that want more control over status, like code_review
, could implement there own status change behavior.
I'm considering a simple revision to r16551 that would preserve behavior prior to r16551. Fixing this issue might involve simple changes on the stable branches and more complex changes on trunk.
I noticed that the hint "The/Next status will be …" is only added if no other operations are defined. We may want to add it for all operations in which the status is changed.
Proposed changes in log:rjollos.git:t13013_ctw_other_ops.
may_set_owner
needs to be added toConfigurableTicketWorkflow.operations
on 1.2-stable.