rt
rt copied to clipboard
ExtractSubjectTag Action: prepend, not append, remote system's subject tag
Too long (200+) ticket subjects (produced by this action) are shortened automatically. This could cut off the remote system's subject tag if at the end.
How to reproduce
- Setup two RTs, say, Tom and Jerry
- In Tom create a ticket with a loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong subject, add Jerry as requestor and reply something
- In Jerry reply to the ticket
- In Tom reply to the ticket -> opens separate ticket at Jerry
Why exactly this happens
To understand the following we need to remember that there are ticket subjects and eMail subjects.
- In Tom the newly created ticket has the ID 1 and the ticket subject
looooooo...
(cut off). - On "reply" (it's not actually a reply, but the very first message of the whole conversation) Tom sends an eMail to Jerry with the eMail subject
[%s #%d] %s
, i.e.[tom #1] looooooo...
(cut off). - That eMail creates a new ticket in Jerry with ID 1 and the eMail subject from above as ticket subject.
- On (actual) reply Jerry sends an eMail to Tom with the eMail subject
[%s #%d] %s
, i.e.[jerry #1] [tom #1] looooooo...
(cut off). -
Tom recognises
[tom #1]
in the eMail subject and associates the eMail with the existing ticket. -
Tom also recognises the foreign tag
[jerry #1]
and the code I changed in this PR tries(!) to change the ticket subject toloooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong [jerry #1]
(so that on next reply from Tom gets into the right ticket at Jerry). It tries! But, as master Yoda said: Do or do not. There's no try. Effectively Tom doesn’t change the ticket subject as above as[jerry #1]
gets cut off silently due to the database column length. - As the ticket subject stays as-is the next reply from Tom misses
[jerry #1]
. - Therefore Jerry can’t associate it with the already existing ticket and creates a new one.
How to workaround
At least in the Tom RT, preferably in both ones:
- Navigate to Admin/Scrips/Select
- Open On transaction, add any tags in the transaction's subject to the ticket's subject
- Set Action to User Defined
- Set Custom action preparation code to
1;
- Copy the code given below to Custom action commit code
- Apply this PR as patch
- Save Changes
https://github.com/bestpractical/rt/blob/cbfe3cd385ef5e2c7fded70367348d80c965c6d1/lib/RT/Action/ExtractSubjectTag.pm#L103-L131
CC @lippserd