rt icon indicating copy to clipboard operation
rt copied to clipboard

AutoOpenInactive bugfix and action prepare return values

Open NReilingh opened this issue 1 year ago • 1 comments

This PR originated as an unexpected behavior on my production RT instance. I noticed that tickets were being moved into open status unexpectedly -- for example, a new ticket that the requestor made the first reply to would be opened by the requestor's reply.

I initially thought this was a bug in AutoOpen, so I went looking through the code of it and other actions. I came across a sort of red herring -- that the Prepare guards were returning true instead of false. These actually don't have a functional effect because the Commit phase will return early if the last part of Prepare is not reached, but they do make the debug log messages more confusing since, really, Commit should never be run if Prepare fails to satisfy all of its guard clauses.

Eventually, though, I realized that AutoOpenInactive was running not just on inactive statuses (but also on initial statuses), and so it was the culprit of my "new tickets being auto-opened" problem.

I am submitting these two commits to fix the bug in AutoOpenInactive so that its behavior matches its documentation and name (only operating on tickets in an inactive status), and to clean up the Prepare blocks of three RT Actions so that the return value semantics are more correct.

NReilingh avatar May 19 '23 21:05 NReilingh