mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-15 17:25:26 -04:00
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 <michaelxer@users.noreply.github.com>
This commit is contained in:
+2
-6
@@ -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(() => {});
|
||||
|
||||
Reference in New Issue
Block a user