feat(06.2-02): frontend — is_shared badge fix + permission dropdown + View/Edit toggle

- DocumentCard.vue: fix Shared pill to read doc.is_shared (was doc.share_count > 0)
- ShareModal.vue: add permission select between handle input and submit button
- ShareModal.vue: replace static "view" span with View/Edit toggle group per share row
- ShareModal.vue: add handlePermissionChange with optimistic update + rollback on error
- documents.js: update shareDocument(docId, handle, permission='view') signature
- documents.js: add updateSharePermission(shareId, permission) action
- api/client.js: pass permission in createShare POST body
- api/client.js: add updateSharePermission PATCH helper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
curo1305
2026-05-31 15:07:04 +02:00
co-authored by Claude Sonnet 4.6
parent ea231853e9
commit 34b18a9f08
4 changed files with 69 additions and 8 deletions
+7 -3
View File
@@ -156,8 +156,8 @@ export const useDocumentsStore = defineStore('documents', () => {
total.value = Math.max(0, total.value - 1)
}
async function shareDocument(docId, recipientHandle) {
try { return await api.createShare(docId, recipientHandle) } catch (e) { throw e }
async function shareDocument(docId, recipientHandle, permission = 'view') {
try { return await api.createShare(docId, recipientHandle, permission) } catch (e) { throw e }
}
async function revokeShare(shareId) {
@@ -168,5 +168,9 @@ export const useDocumentsStore = defineStore('documents', () => {
try { return await api.listShares(docId) } catch (e) { throw e }
}
return { documents, total, loading, error, uploadProgress, currentFolderId, searchQuery, sortField, sortOrder, fetchDocuments, upload, remove, reclassify, moveToFolder, shareDocument, revokeShare, listShares }
async function updateSharePermission(shareId, permission) {
try { return await api.updateSharePermission(shareId, permission) } catch (e) { throw e }
}
return { documents, total, loading, error, uploadProgress, currentFolderId, searchQuery, sortField, sortOrder, fetchDocuments, upload, remove, reclassify, moveToFolder, shareDocument, revokeShare, listShares, updateSharePermission }
})