From 39bebabcd64c0a1f5b504527b1becfb86d881bff Mon Sep 17 00:00:00 2001 From: urec56 Date: Tue, 20 Aug 2024 14:34:35 +0400 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=B0=D0=B3=D1=84=D0=B8=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/dao/chat.py | 2 +- app/services/chat_service.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/dao/chat.py b/app/dao/chat.py index cd24531..8f1d839 100644 --- a/app/dao/chat.py +++ b/app/dao/chat.py @@ -58,7 +58,7 @@ class ChatDAO(BaseDAO): stmt = insert(UserChat).values(user_id=user_id, chat_id=chat_id) await self.session.execute(stmt) except IntegrityError: - raise UserAlreadyInChatException + pass async def change_data(self, chat_id: int, chat_name: str, avatar_image: HttpUrl) -> None: stmt = ( diff --git a/app/services/chat_service.py b/app/services/chat_service.py index 5fc3b6b..11f8e6d 100644 --- a/app/services/chat_service.py +++ b/app/services/chat_service.py @@ -51,10 +51,7 @@ class ChatService: avatar_image=user_chat_for.avatar_image ) await uow.chat.add_user_to_chat(user_id, chat_id) - try: - await uow.chat.add_user_to_chat(settings.ADMIN_USER_ID, chat_id) - except UserAlreadyInChatException: - pass + await uow.chat.add_user_to_chat(settings.ADMIN_USER_ID, chat_id) async with RedisService(is_raise=True) as redis: await redis.delete_key(key=f"user_allowed_chats: {user_id}") await uow.commit()