parent
d07552424c
commit
1a3866c4f6
|
@ -211,9 +211,15 @@ export class ChatService {
|
||||||
file?: MiDriveFile | null;
|
file?: MiDriveFile | null;
|
||||||
uri?: string | null;
|
uri?: string | null;
|
||||||
}): Promise<Packed<'ChatMessageLite'>> {
|
}): Promise<Packed<'ChatMessageLite'>> {
|
||||||
const memberships = await this.chatRoomMembershipsRepository.findBy({ roomId: toRoom.id });
|
const memberships = (await this.chatRoomMembershipsRepository.findBy({ roomId: toRoom.id })).map(m => ({
|
||||||
|
userId: m.userId,
|
||||||
|
isMuted: m.isMuted,
|
||||||
|
})).concat({ // ownerはmembershipレコードを作らないため
|
||||||
|
userId: toRoom.ownerId,
|
||||||
|
isMuted: false,
|
||||||
|
});
|
||||||
|
|
||||||
if (toRoom.ownerId !== fromUser.id && !memberships.some(member => member.userId === fromUser.id)) {
|
if (!memberships.some(member => member.userId === fromUser.id)) {
|
||||||
throw new Error('you are not a member of the room');
|
throw new Error('you are not a member of the room');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue