feat: add ENABLE_USER_STATUS toggle for admin-controlled user status visibility (#20488)
* feat: add ENABLE_USER_STATUS toggle for admin-controlled user status visibility feat: add ENABLE_USER_STATUS toggle for admin-controlled user status visibility Add a new admin panel toggle (Admin > Settings > General) called "User Status" that allows administrators to globally enable or disable user status functionality. When disabled: - User status API endpoints return 403 Forbidden - Status emoji, message, and "Update your status" button are hidden from the user menu The setting: - Defaults to True (enabled) - Can be overridden via ENABLE_USER_STATUS environment variable - Persists across restarts using PersistentConfig Files modified: - backend/open_webui/config.py - Added ENABLE_USER_STATUS PersistentConfig - backend/open_webui/main.py - App state init and features dict - backend/open_webui/routers/auths.py - AdminConfig model and endpoints - backend/open_webui/routers/users.py - 403 guards on status endpoints - src/lib/components/admin/Settings/General.svelte - Toggle UI - src/lib/components/layout/Sidebar/UserMenu.svelte - Conditional status display * Update UserMenu.svelte feat: add ENABLE_USER_STATUS toggle for admin-controlled user status visibility Add a new admin panel toggle (Admin > Settings > General) called "User Status" that allows administrators to globally enable or disable user status functionality. When disabled: - User status API endpoints return 403 Forbidden - Active/Away indicator with blinking dot is hidden from the user menu - Status emoji, message, and "Update your status" button are hidden from the user menu The setting: - Defaults to True (enabled) - Can be overridden via ENABLE_USER_STATUS environment variable - Persists across restarts using PersistentConfig Files modified: - backend/open_webui/config.py - Added ENABLE_USER_STATUS PersistentConfig - backend/open_webui/main.py - App state init and features dict - backend/open_webui/routers/auths.py - AdminConfig model and endpoints - backend/open_webui/routers/users.py - 403 guards on status endpoints - src/lib/components/admin/Settings/General.svelte - Toggle UI - src/lib/components/layout/Sidebar/UserMenu.svelte - Conditional status display * nuke the indicator * fix
This commit is contained in:
@@ -757,6 +757,14 @@
|
||||
<Switch bind:state={adminConfig.ENABLE_USER_WEBHOOKS} />
|
||||
</div>
|
||||
|
||||
<div class="mb-2.5 flex w-full items-center justify-between pr-2">
|
||||
<div class=" self-center text-xs font-medium">
|
||||
{$i18n.t('User Status')}
|
||||
</div>
|
||||
|
||||
<Switch bind:state={adminConfig.ENABLE_USER_STATUS} />
|
||||
</div>
|
||||
|
||||
<div class="mb-2.5">
|
||||
<div class=" self-center text-xs font-medium mb-2">
|
||||
{$i18n.t('Response Watermark')}
|
||||
|
||||
@@ -793,7 +793,7 @@
|
||||
{#if $user !== undefined && $user !== null}
|
||||
<UserMenu
|
||||
role={$user?.role}
|
||||
profile={true}
|
||||
profile={$config?.features?.enable_user_status ?? true}
|
||||
showActiveUsers={false}
|
||||
on:show={(e) => {
|
||||
if (e.detail === 'archived-chat') {
|
||||
@@ -812,6 +812,7 @@
|
||||
aria-label={$i18n.t('Open User Profile Menu')}
|
||||
/>
|
||||
|
||||
{#if $config?.features?.enable_user_status}
|
||||
<div class="absolute -bottom-0.5 -right-0.5">
|
||||
<span class="relative flex size-2.5">
|
||||
<span
|
||||
@@ -824,6 +825,7 @@
|
||||
></span>
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</UserMenu>
|
||||
@@ -1360,7 +1362,7 @@
|
||||
{#if $user !== undefined && $user !== null}
|
||||
<UserMenu
|
||||
role={$user?.role}
|
||||
profile={true}
|
||||
profile={$config?.features?.enable_user_status ?? true}
|
||||
showActiveUsers={false}
|
||||
on:show={(e) => {
|
||||
if (e.detail === 'archived-chat') {
|
||||
@@ -1379,6 +1381,7 @@
|
||||
aria-label={$i18n.t('Open User Profile Menu')}
|
||||
/>
|
||||
|
||||
{#if $config?.features?.enable_user_status}
|
||||
<div class="absolute -bottom-0.5 -right-0.5">
|
||||
<span class="relative flex size-2.5">
|
||||
<span
|
||||
@@ -1391,6 +1394,7 @@
|
||||
></span>
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class=" self-center font-medium">{$user?.name}</div>
|
||||
</div>
|
||||
|
||||
@@ -203,6 +203,7 @@
|
||||
<hr class=" border-gray-50/30 dark:border-gray-800/30 my-1.5 p-0" />
|
||||
{/if}
|
||||
|
||||
|
||||
<DropdownMenu.Item
|
||||
class="flex rounded-xl py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition cursor-pointer"
|
||||
on:click={async () => {
|
||||
|
||||
Reference in New Issue
Block a user