feat(fusion_helpdesk): group My Tickets into Critical/New/Solved sections

The flat write_date-sorted list was hard to scan with 50+ tickets — solved
ones were intermixed with active ones, and there was no signal for
priority. Bucket each ticket server-side into 'critical' (open + priority
High/Urgent), 'solved' (stage marked fold=True on central) or 'open'
(everything else), and render three labelled sections in the dialog with
sticky headers, count badges, and per-group accent colours. Backend keeps
its write_date desc order so latest is always at top within each bucket.

Bucketing uses helpdesk.stage.fold (not the stage name) so renaming
"Solved" to "Done" on the central won't quietly mis-categorise rows.
Adds bucket_ticket() in utils.py with unit tests covering the
folded-wins-over-priority precedence and the missing-priority fallback.

Also surfaces a small Urgent (triangle) / High (arrow) icon on each row
so a critical ticket reads at a glance even after a user scrolls past
the section header.

Bumps fusion_helpdesk to 19.0.1.6.0.
This commit is contained in:
gsinghpal
2026-05-27 11:04:31 -04:00
parent aabfc1afe7
commit 3e5ced1655
7 changed files with 172 additions and 10 deletions

View File

@@ -101,6 +101,22 @@ def is_public_message(msg):
return not msg.get('subtype_is_internal', False)
def bucket_ticket(stage_is_folded, priority):
"""Bucket key for the "My Tickets" inbox: 'critical' | 'solved' | 'open'.
Folded stages (Solved, Cancelled — whatever the central support team has
marked as kanban-folded) collapse into the 'solved' bucket regardless of
priority, because a closed ticket is not actionable. For everything still
open, High and Urgent (priority '2'/'3') promote to 'critical' so the
reporter can find blockers without scrolling. Anything else is 'open'.
"""
if stage_is_folded:
return 'solved'
if (priority or '0') in ('2', '3'):
return 'critical'
return 'open'
def compute_unread_count(tickets, seen_by_id):
"""Number of tickets with a support reply the user hasn't seen.