fix: Improve plugin ui entry points, Fix chat scroll, fix notifications, fix user rights
This commit is contained in:
@@ -87,6 +87,17 @@ describe('DirectCallService', () => {
|
||||
expect(context.service.incomingCall()).toBeNull();
|
||||
});
|
||||
|
||||
it('ignores incoming call events when the current user is not a participant', async () => {
|
||||
const context = createServiceContext({ currentUser: charlie, allUsers: [alice, bob, charlie] });
|
||||
|
||||
context.directCallEvents.next(createCallEvent('ring', alice, ['alice', 'bob']));
|
||||
|
||||
await vi.waitFor(() => expect(context.service.sessionById('dm-alice-bob')).toBeNull());
|
||||
expect(context.audio.playLoop).not.toHaveBeenCalled();
|
||||
expect(context.directMessages.createConversation).not.toHaveBeenCalled();
|
||||
expect(context.directMessages.createGroupConversation).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('answers an incoming call from the modal action', async () => {
|
||||
const context = createServiceContext({ currentUser: bob, allUsers: [alice, bob] });
|
||||
|
||||
|
||||
@@ -355,6 +355,10 @@ export class DirectCallService {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.callPayloadIncludesParticipant(payload, meId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const participants = this.callParticipantsFromPayload(payload);
|
||||
const existing = this.sessionById(payload.callId);
|
||||
const incomingSession = this.createSession({
|
||||
@@ -671,6 +675,11 @@ export class DirectCallService {
|
||||
]);
|
||||
}
|
||||
|
||||
private callPayloadIncludesParticipant(payload: DirectCallEventPayload, participantId: string): boolean {
|
||||
return payload.participantIds.includes(participantId)
|
||||
|| (payload.participants ?? []).some((participant) => participant.userId === participantId);
|
||||
}
|
||||
|
||||
private groupConversationTitle(session: DirectCallSession): string {
|
||||
const names = Object.values(session.participants)
|
||||
.map((participant) => participant.profile.displayName || participant.profile.username || participant.userId);
|
||||
|
||||
Reference in New Issue
Block a user