fix: Improve plugin ui entry points, Fix chat scroll, fix notifications, fix user rights

This commit is contained in:
2026-05-17 16:09:16 +02:00
parent 8e3ccf4157
commit 8631290c01
35 changed files with 1560 additions and 619 deletions

View File

@@ -29,6 +29,7 @@ function createContext(overrides: Record<string, unknown> = {}) {
debugging: {},
currentUser: null,
currentRoom: null,
savedRooms: [],
...overrides
} as const;
}
@@ -42,7 +43,8 @@ describe('dispatchIncomingMessage room-scoped sync', () => {
const context = createContext({
db: { getMessages },
webrtc: { sendToPeer },
currentRoom: { id: 'room-a' }
currentRoom: { id: 'room-a' },
savedRooms: [{ id: 'room-b' }]
});
await firstValueFrom(
@@ -76,7 +78,8 @@ describe('dispatchIncomingMessage room-scoped sync', () => {
const context = createContext({
db: { getMessages },
webrtc: { sendToPeer },
currentRoom: { id: 'room-a' }
currentRoom: { id: 'room-a' },
savedRooms: [{ id: 'room-b' }]
});
await firstValueFrom(
@@ -97,4 +100,29 @@ describe('dispatchIncomingMessage room-scoped sync', () => {
messages: roomBMessages
});
});
it('ignores chat messages for rooms that are not saved or currently viewed', async () => {
const saveMessage = vi.fn(async () => undefined);
const rememberMessageRoom = vi.fn();
const context = createContext({
db: { saveMessage },
attachments: { rememberMessageRoom },
currentRoom: { id: 'room-a' },
savedRooms: [{ id: 'room-a' }]
});
const action = await firstValueFrom(
dispatchIncomingMessage(
{
type: 'chat-message',
message: createMessage({ roomId: 'room-b' })
} as never,
context as never
).pipe(defaultIfEmpty(null))
);
expect(action).toBeNull();
expect(saveMessage).not.toHaveBeenCalled();
expect(rememberMessageRoom).not.toHaveBeenCalled();
});
});