feat: projekte teilen im frontend
Teilen-Bereich auf der Projektseite mit Mitgliedern und Rollen, Verlassen für Mitglieder. Geteilte Projekte mit Symbol und Besitzer, Clips anderer mit "von <Name>"; ohne Schreibrecht keine Bearbeiten- Buttons und eine reine Leseansicht. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d3a52c25a7
commit
4ae459cf53
17 files changed
+533
-95
No files matched your search
@@ -8,6 +8,8 @@ import { ClipConflictError, matchesFilter, useClipsStore } from './clips'
|
||||
function clip(overrides: Partial<Clip> = {}): Clip {
|
||||
return {
|
||||
id: 1,
|
||||
user_id: 1,
|
||||
owner_name: 'anna',
|
||||
kind: 'text',
|
||||
title: null,
|
||||
content: 'hello',
|
||||
@@ -174,16 +176,22 @@ describe('clips store', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('detaches clips from a deleted project like the backend', () => {
|
||||
it('detaches clips from a deleted or left project like the backend', () => {
|
||||
const store = useClipsStore()
|
||||
store.upsert(clip({ id: 1, project_id: 4, version: 2 }))
|
||||
store.upsert(clip({ id: 2, project_id: 5 }))
|
||||
store.upsert(clip({ id: 3, project_id: 4, user_id: 2, owner_name: 'bert' }))
|
||||
const listener = vi.fn()
|
||||
store.subscribe(listener)
|
||||
|
||||
store.detachProject(4)
|
||||
store.detachProject(4, 1)
|
||||
|
||||
const byId = Object.fromEntries(store.items.map((c) => [c.id, c]))
|
||||
// Own clip stays without project, the other member's clip is no longer visible
|
||||
expect(byId[1]).toMatchObject({ project_id: null, version: 3 })
|
||||
expect(byId[2]).toMatchObject({ project_id: 5, version: 1 })
|
||||
expect(byId[3]).toBeUndefined()
|
||||
expect(listener).toHaveBeenCalledWith({ deleted: 3 })
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user