From cc8ba04ea88b82ff0b559f6501eb6545fb0812b3 Mon Sep 17 00:00:00 2001 From: Michael <52305679+michaelxer@users.noreply.github.com> Date: Thu, 11 Jun 2026 21:19:06 +0700 Subject: [PATCH] fix: use correct element IDs for privilege-gated button hiding (#3705) * fix: use correct element IDs for privilege-gated button hiding The privilege-gated button hiding in initializeEventListeners() used stale element IDs that no longer exist in the DOM: - 'tool-bash-btn' -> 'bash-toggle-btn' (the actual shell button ID) - 'tool-image-btn' -> 'set-imgEnabledToggle' (admin settings toggle, since no standalone image button exists in the composer) Without this fix, users without can_use_bash / can_generate_images privileges still see buttons that appear to work but then fail. * fix: remove incorrect image generation toggle targeting The set-imgEnabledToggle is the global admin Image Generation master switch, not a per-user composer control. Non-admins without can_generate_images never render that toggle, so the lookup is null and the branch no-ops. Admins without the privilege get the app-wide toggle force-unchecked based on personal privilege, which is confusing. There is no composer image button in the DOM, so nothing to hide here. Drop the can_generate_images block entirely as vdmkenny requested. --------- Co-authored-by: michaelxer --- static/app.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/static/app.js b/static/app.js index c75070bf2..e1ffcc612 100644 --- a/static/app.js +++ b/static/app.js @@ -1159,7 +1159,7 @@ function initializeEventListeners() { if (!p.can_use_bash) { const bashToggle = document.getElementById('bash-toggle'); if (bashToggle) bashToggle.closest('.chat-input-toggle')?.style.setProperty('display', 'none'); - const bashBtn = document.getElementById('tool-bash-btn'); + const bashBtn = document.getElementById('bash-toggle-btn'); if (bashBtn) bashBtn.style.display = 'none'; } // Hide document button @@ -1176,11 +1176,7 @@ function initializeEventListeners() { const resOverflow = document.getElementById('overflow-research-btn'); if (resOverflow) resOverflow.style.display = 'none'; } - // Hide image generation options - if (!p.can_generate_images) { - const imgBtn = document.getElementById('tool-image-btn'); - if (imgBtn) imgBtn.style.display = 'none'; - } + } }) .catch(() => {});