mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-29 06:32:52 +00:00
fix: chat menu Copy shows while chat export is not allowed (#32960)
* fix: chat menu Copy shows while chat export is not allowed Users without the chat export permission get no Download entry in the chat menu, but Copy was still there and copied the whole chat as text, the same as the plain text download. Copy is now hidden as well while chat export is not allowed. Refs #32830 * fix: chat menu opens empty once Copy is hidden With Copy hidden for users without the chat export permission, a temporary chat with no artifacts that is not scrolled down had nothing left in its chat menu, so the button opened an empty dropdown. The button is now hidden in that case and shows again as soon as the menu has an entry. Refs #32830
This commit is contained in:
parent
82d6f230b4
commit
b17ee7d839
2 changed files with 20 additions and 19 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
import {
|
||||
WEBUI_NAME,
|
||||
artifactContents,
|
||||
banners,
|
||||
chatId,
|
||||
config,
|
||||
|
|
@ -127,7 +128,7 @@
|
|||
{title || chat?.chat?.title || $i18n.t('New Chat')}
|
||||
</h1>
|
||||
|
||||
{#if shareEnabled && chat && (chat.id || $temporaryChatEnabled)}
|
||||
{#if shareEnabled && chat && (chat.id || $temporaryChatEnabled) && (scrollToTop || ($artifactContents ?? []).length > 0 || (!readOnly && !$temporaryChatEnabled) || $user?.role === 'admin' || ($user?.permissions?.chat?.export ?? true))}
|
||||
<Menu
|
||||
{chat}
|
||||
{shareEnabled}
|
||||
|
|
|
|||
|
|
@ -463,26 +463,26 @@
|
|||
<div class="flex items-center line-clamp-1">{$i18n.t('PDF document (.pdf)')}</div>
|
||||
</button>
|
||||
</DropdownSub>
|
||||
|
||||
<button
|
||||
draggable="false"
|
||||
class="flex h-[1.6875rem] w-full items-center gap-2 rounded-xl px-2 text-[0.8125rem] cursor-pointer select-none hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
id="chat-copy-button"
|
||||
on:click={async () => {
|
||||
const res = await copyToClipboard(await getChatAsText()).catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
|
||||
if (res) {
|
||||
toast.success($i18n.t('Copied to clipboard'));
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Clipboard className="size-3.5" strokeWidth="1.5" />
|
||||
<div class="flex items-center">{$i18n.t('Copy')}</div>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<button
|
||||
draggable="false"
|
||||
class="flex h-[1.6875rem] w-full items-center gap-2 rounded-xl px-2 text-[0.8125rem] cursor-pointer select-none hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
id="chat-copy-button"
|
||||
on:click={async () => {
|
||||
const res = await copyToClipboard(await getChatAsText()).catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
|
||||
if (res) {
|
||||
toast.success($i18n.t('Copied to clipboard'));
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Clipboard className="size-3.5" strokeWidth="1.5" />
|
||||
<div class="flex items-center">{$i18n.t('Copy')}</div>
|
||||
</button>
|
||||
|
||||
{#if !readOnly && !$temporaryChatEnabled && chat?.id}
|
||||
<hr class="border-gray-50/30 dark:border-gray-800/30 mx-1 my-0.5" />
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue