From 8da1368a0b1be76dcf128e486f197f4a0654f941 Mon Sep 17 00:00:00 2001
From: syuilo <4439005+syuilo@users.noreply.github.com>
Date: Tue, 25 Mar 2025 08:05:59 +0900
Subject: [PATCH] =?UTF-8?q?fix(backend):=20=E6=97=A2=E5=AD=98=E3=81=AE?=
 =?UTF-8?q?=E3=83=AB=E3=83=BC=E3=83=A0=E3=83=A1=E3=83=B3=E3=83=90=E3=83=BC?=
 =?UTF-8?q?=E3=82=92=E6=94=B9=E3=82=81=E3=81=A6=E6=8B=9B=E5=BE=85=E3=81=A7?=
 =?UTF-8?q?=E3=81=8D=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 packages/backend/src/core/ChatService.ts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/packages/backend/src/core/ChatService.ts b/packages/backend/src/core/ChatService.ts
index eece5d0da3..57e33af107 100644
--- a/packages/backend/src/core/ChatService.ts
+++ b/packages/backend/src/core/ChatService.ts
@@ -518,6 +518,10 @@ export class ChatService {
 
 		const room = await this.chatRoomsRepository.findOneByOrFail({ id: roomId, ownerId: inviterId });
 
+		if (await this.isRoomMember(room, inviteeId)) {
+			throw new Error('already member');
+		}
+
 		const existingInvitation = await this.chatRoomInvitationsRepository.findOneBy({ roomId, userId: inviteeId });
 		if (existingInvitation) {
 			throw new Error('already invited');