From 1a3866c4f67fb5a745a7966220286680b810d23b Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Thu, 3 Apr 2025 11:15:16 +0900 Subject: [PATCH] =?UTF-8?q?fix(backend/chat):=20=E8=87=AA=E5=88=86?= =?UTF-8?q?=E3=81=8C=E4=BD=9C=E3=81=A3=E3=81=9F=E3=83=81=E3=83=A3=E3=83=83?= =?UTF-8?q?=E3=83=88=E3=83=AB=E3=83=BC=E3=83=A0=E3=81=AB=E4=BB=96=E4=BA=BA?= =?UTF-8?q?=E3=81=8C=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92?= =?UTF-8?q?=E9=80=81=E3=81=A3=E3=81=9F=E3=81=A8=E3=81=8D=E3=81=AB=E6=9C=AA?= =?UTF-8?q?=E8=AA=AD=E3=81=AB=E3=81=AA=E3=82=89=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #15748 --- packages/backend/src/core/ChatService.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/ChatService.ts b/packages/backend/src/core/ChatService.ts index df1c384b54..6194f624b1 100644 --- a/packages/backend/src/core/ChatService.ts +++ b/packages/backend/src/core/ChatService.ts @@ -211,9 +211,15 @@ export class ChatService { file?: MiDriveFile | null; uri?: string | null; }): Promise> { - 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'); }