From 6aeaef6f1d7051e2d28f3df404de11d42e050ec1 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 13 Apr 2026 19:44:30 -0400 Subject: [PATCH] fix(badges): trusted staff visibility driven by filter, not edit mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Edit mode should not override the filter state — staff set their filters and turn off edit mode all the time. The real split is trusted staff vs kiosk/public, not edit mode on/off. Trusted and above: qry_printed_status is the sole control over printed badge visibility, regardless of edit mode state. Public (kiosk) / authenticated / anonymous: always unprinted only. Badge kiosks run at public_access and should never expose a list of already-printed badges to attendees. Co-Authored-By: Claude Sonnet 4.6 --- .../(badges)/badges/ae_comp__badge_obj_li.svelte | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte index 6e577b8a..bf6f6b44 100644 --- a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte @@ -96,21 +96,20 @@ let visible_badge_obj_li = $derived( if (list === undefined || list === null) return null; if (!Array.isArray(list)) return []; - // The Printed Status filter dropdown is accessible to: trusted+edit OR manager+. - // Match that gate here so the filter actually controls what's displayed. - const can_use_filter = (is_trusted && is_edit_mode) || $ae_loc.manager_access; const filtered = list.filter((item: any) => { if (!item) return false; - if (can_use_filter) { - // Filter dropdown controls visibility for users who can access it. + if (is_trusted) { + // Trusted staff and above: qry_printed_status is the authoritative control. + // Filter state persists across edit mode toggles — intentional. Staff set + // their filter and it stays regardless of whether edit mode is on or off. const ps = badges_loc.current.qry_printed_status; if (ps === 'printed') return (item.print_count ?? 0) >= 1 && !item.hide; if (ps === 'not_printed') return (item.print_count ?? 0) < 1 && !item.hide; return !item.hide; // 'all' — show everything non-hidden } - // Kiosk / attendee / below-trusted: only unprinted badges. - // The filter dropdown is not visible at these access levels, so - // qry_printed_status is not a reliable signal here. + // Public (kiosk) / authenticated / anonymous: only unprinted. + // Badge kiosks run at public_access — attendees should only see their own + // unprinted badge, never a list of already-printed ones. return (item.print_count ?? 0) < 1 && !item.hide; });