This commit is contained in:
Timothy Jaeryang Baek 2026-10-09 17:20:37 +04:00
parent b3ce7de8d3
commit d4f01d7344
3 changed files with 30 additions and 4 deletions

View file

@ -1,4 +1,6 @@
<script lang="ts">
import WorkspaceAccessModal from '$lib/components/workspace/common/WorkspaceAccessModal.svelte';
let accessModal: WorkspaceAccessModal;
import { marked } from 'marked';
import { toast } from 'svelte-sonner';
import fileSaver from 'file-saver';
@ -349,6 +351,8 @@
});
</script>
<WorkspaceAccessModal bind:this={accessModal} resourceType="notes" onUpdated={init} />
<svelte:head>
<!-- LICENSE covers this Open WebUI browser-title identifier.
Do not alter, remove, obscure, or replace it except as LICENSE permits:
@ -667,6 +671,9 @@
</Tooltip>
{:else}
<NoteMenu
onAccess={note.user_id === $user?.id || $user?.role === 'admin'
? () => accessModal.open(note.id)
: null}
show={openNoteMenuId === note.id}
onDownload={(type) => {
selectedNote = note;
@ -755,6 +762,9 @@
</Tooltip>
{:else}
<NoteMenu
onAccess={note.user_id === $user?.id || $user?.role === 'admin'
? () => accessModal.open(note.id)
: null}
onDownload={(type) => {
selectedNote = note;

View file

@ -1,4 +1,5 @@
<script lang="ts">
import LockClosed from '$lib/components/icons/LockClosed.svelte';
import { getContext } from 'svelte';
import Dropdown from '$lib/components/common/Dropdown.svelte';
@ -16,12 +17,13 @@
import CloudArrowUp from '$lib/components/icons/CloudArrowUp.svelte';
import Bold from '$lib/components/icons/Bold.svelte';
const i18n = getContext('i18n');
const i18n = getContext<typeof import('$lib/i18n').default>('i18n');
export let show = false;
export let className = 'max-w-[11.25rem]';
export let onDownload = (type) => {};
export let onAccess: (() => void) | null = null;
export let onDelete = () => {};
export let onPin = null;
export let isPinned = false;
@ -48,6 +50,17 @@
<div slot="content">
<DropdownMenu className="min-w-[11.25rem]">
{#if onAccess}
<button
type="button"
class="select-none flex h-[1.6875rem] w-full cursor-pointer items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-gray-900 dark:hover:text-gray-100"
on:click={() => onAccess?.()}
>
<LockClosed className="size-3.5" />
<div class="flex items-center">{$i18n.t('Access')}</div>
</button>
{/if}
{#if showAutoFormat}
<Tooltip
className="w-full"

View file

@ -7,9 +7,10 @@
import { getPromptById, updatePromptAccessGrants } from '$lib/apis/prompts';
import { getSkillById, updateSkillAccessGrants } from '$lib/apis/skills';
import { getToolById, updateToolAccessGrants } from '$lib/apis/tools';
import { getNoteById, updateNoteAccessGrants } from '$lib/apis/notes';
import AccessControlModal from './AccessControlModal.svelte';
export let resourceType: 'models' | 'knowledge' | 'prompts' | 'skills' | 'tools';
export let resourceType: 'models' | 'knowledge' | 'prompts' | 'skills' | 'tools' | 'notes';
export let onUpdated: () => void | Promise<void> = () => {};
const i18n = getContext<any>('i18n');
const loaders = {
@ -17,13 +18,15 @@
knowledge: getKnowledgeById,
prompts: getPromptById,
skills: getSkillById,
tools: getToolById
tools: getToolById,
notes: getNoteById
};
const savers = {
knowledge: updateKnowledgeAccessGrants,
prompts: updatePromptAccessGrants,
skills: updateSkillAccessGrants,
tools: updateToolAccessGrants
tools: updateToolAccessGrants,
notes: updateNoteAccessGrants
};
let show = false;
let saving = false;