fix(ui): gate all chat export formats by chat.export permission (#25914)
This commit is contained in:
2 files changed
+63
-61
No files matched your search
@@ -379,17 +379,18 @@
|
|||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<DropdownSub>
|
{#if $user?.role === 'admin' || ($user.permissions?.chat?.export ?? true)}
|
||||||
<button
|
<DropdownSub>
|
||||||
slot="trigger"
|
<button
|
||||||
draggable="false"
|
slot="trigger"
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
draggable="false"
|
||||||
>
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
||||||
<Download strokeWidth="1.5" />
|
>
|
||||||
|
<Download strokeWidth="1.5" />
|
||||||
|
|
||||||
|
<div class="flex items-center">{$i18n.t('Download')}</div>
|
||||||
|
</button>
|
||||||
|
|
||||||
<div class="flex items-center">{$i18n.t('Download')}</div>
|
|
||||||
</button>
|
|
||||||
{#if $user?.role === 'admin' || ($user.permissions?.chat?.export ?? true)}
|
|
||||||
<button
|
<button
|
||||||
draggable="false"
|
draggable="false"
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
||||||
@@ -399,27 +400,28 @@
|
|||||||
>
|
>
|
||||||
<div class="flex items-center line-clamp-1">{$i18n.t('Export chat (.json)')}</div>
|
<div class="flex items-center line-clamp-1">{$i18n.t('Export chat (.json)')}</div>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
|
||||||
<button
|
|
||||||
draggable="false"
|
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
|
||||||
on:click={() => {
|
|
||||||
downloadTxt();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div class="flex items-center line-clamp-1">{$i18n.t('Plain text (.txt)')}</div>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
draggable="false"
|
draggable="false"
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
downloadPdf();
|
downloadTxt();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="flex items-center line-clamp-1">{$i18n.t('PDF document (.pdf)')}</div>
|
<div class="flex items-center line-clamp-1">{$i18n.t('Plain text (.txt)')}</div>
|
||||||
</button>
|
</button>
|
||||||
</DropdownSub>
|
|
||||||
|
<button
|
||||||
|
draggable="false"
|
||||||
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
||||||
|
on:click={() => {
|
||||||
|
downloadPdf();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div class="flex items-center line-clamp-1">{$i18n.t('PDF document (.pdf)')}</div>
|
||||||
|
</button>
|
||||||
|
</DropdownSub>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
draggable="false"
|
draggable="false"
|
||||||
|
|||||||
@@ -313,19 +313,19 @@
|
|||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<DropdownSub
|
{#if $user?.role === 'admin' || ($user.permissions?.chat?.export ?? true)}
|
||||||
contentClass="select-none rounded-2xl p-1 z-50 bg-white dark:bg-gray-850 dark:text-white shadow-lg border border-gray-100 dark:border-gray-800"
|
<DropdownSub
|
||||||
>
|
contentClass="select-none rounded-2xl p-1 z-50 bg-white dark:bg-gray-850 dark:text-white shadow-lg border border-gray-100 dark:border-gray-800"
|
||||||
<button
|
|
||||||
slot="trigger"
|
|
||||||
draggable="false"
|
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
|
||||||
>
|
>
|
||||||
<Download strokeWidth="1.5" />
|
<button
|
||||||
<div class="flex items-center">{$i18n.t('Download')}</div>
|
slot="trigger"
|
||||||
</button>
|
draggable="false"
|
||||||
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
||||||
|
>
|
||||||
|
<Download strokeWidth="1.5" />
|
||||||
|
<div class="flex items-center">{$i18n.t('Download')}</div>
|
||||||
|
</button>
|
||||||
|
|
||||||
{#if $user?.role === 'admin' || ($user.permissions?.chat?.export ?? true)}
|
|
||||||
<button
|
<button
|
||||||
draggable="false"
|
draggable="false"
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
||||||
@@ -335,28 +335,28 @@
|
|||||||
>
|
>
|
||||||
<div class="flex items-center line-clamp-1">{$i18n.t('Export chat (.json)')}</div>
|
<div class="flex items-center line-clamp-1">{$i18n.t('Export chat (.json)')}</div>
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
draggable="false"
|
draggable="false"
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl w-full"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
downloadTxt();
|
downloadTxt();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="flex items-center line-clamp-1">{$i18n.t('Plain text (.txt)')}</div>
|
<div class="flex items-center line-clamp-1">{$i18n.t('Plain text (.txt)')}</div>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
draggable="false"
|
draggable="false"
|
||||||
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
class="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl select-none w-full"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
downloadPdf();
|
downloadPdf();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="flex items-center line-clamp-1">{$i18n.t('PDF document (.pdf)')}</div>
|
<div class="flex items-center line-clamp-1">{$i18n.t('PDF document (.pdf)')}</div>
|
||||||
</button>
|
</button>
|
||||||
</DropdownSub>
|
</DropdownSub>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
draggable="false"
|
draggable="false"
|
||||||
|
|||||||
Reference in new issue
Block a user