Auto-assign on reply (per-inbox toggle)#299
Open
mageaustralia wants to merge 1 commit intoabhinavxd:mainfrom
Open
Auto-assign on reply (per-inbox toggle)#299mageaustralia wants to merge 1 commit intoabhinavxd:mainfrom
mageaustralia wants to merge 1 commit intoabhinavxd:mainfrom
Conversation
When an agent replies to an unassigned email conversation, the conversation is automatically assigned to that agent. Off by default; enabled per-inbox under Admin > Inboxes > Edit. Plumbing notes worth mentioning since they're easy to miss: - The inbox Update function unmarshals config into two LOCAL structs (currentCfg + updateCfg) rather than imodels.Config, then re-marshals back. Anything not on those local structs is silently dropped on every save. Added auto_assign_on_reply to both, and left a comment on the block calling out the trap so the next field-add doesn't fall in it. - The vee-validate/zod schema strips fields it doesn't know about, so the toggle has to be in formSchema.js as well as the SwitchField, or the value never makes it to the API. - NewInbox.vue and EditInbox.vue build their config payloads independently. Both updated. EditInbox also needed the form-load mapping (config.auto_assign_on_reply -> top-level field). - Auto-assign records a self-assign activity via the same code path as manual self-assignment, so the audit trail looks identical. There's a small race window between the GetConversation check and the UpdateAssignee write — concurrent agent replies could both see the conversation as unassigned and both attempt to claim it. Last write wins, no corruption. Atomic "claim if NULL" SQL would be cleaner; left out of this PR to keep the surface small. Happy to add if you'd prefer.
Owner
|
Hey thanks for the PRs! This feature was requested by many at my workplace. thanks again! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
When an agent replies to an unassigned email conversation, the conversation is automatically assigned to that agent. Off by default; enabled per-inbox under Admin > Inboxes > Edit.
Common workflow: a triage agent picks up an inbox, the first agent who actually starts working a ticket claims it. Saves a click after every reply.
Notes worth flagging during review
These caught us out in our fork — both shipped clean here, but worth mentioning so you know I looked at them:
Updatefunction unmarshals config into two LOCAL structs (currentCfg+updateCfg) instead ofimodels.Config, then re-marshals back. Anything not on those local structs is silently dropped on every save. Addedauto_assign_on_replyto both, and left a code comment on the block calling out the trap so the next field-add doesn't fall in it.formSchema.jsas well as the SwitchField — without it the toggle ticks in the UI but never reaches the API.NewInbox.vueandEditInbox.vuebuild their config payloads independently. Both updated.EditInboxalso needed the form-load mapping (config.auto_assign_on_reply→ top-level).Audit trail
Auto-assignment records a
self_assignactivity through the same code path as manual self-assignment (RecordAssigneeUserChange), so the conversation timeline shows "Agent X self-assigned this conversation" — identical to a manual self-assign. Felt important to make this visible rather than silent.A known small race
Between the
GetConversationcheck and theUpdateAssigneewrite, concurrent agent replies could both observe the conversation as unassigned and both attempt to claim it. Last write wins, no corruption. An atomicUPDATE ... WHERE assigned_user_id IS NULLwould be tighter; left out of this PR to keep the surface small. Happy to add if you'd prefer that direction.Test plan