Фикс письма и удаления/редактирования сообщений

This commit is contained in:
urec56 2024-08-29 18:33:51 +04:00
parent bbfc9296a5
commit f5a0ba86b1
3 changed files with 14 additions and 7 deletions

View file

@ -41,6 +41,10 @@ class MessageDAO:
async def delete_message(self, message_id: UUID) -> None:
await self.message.update_one({"id": str(message_id)}, {"$set": {"visibility": False}})
await self.message.update_one(
{"answer_id": str(message_id)},
{"$set": {"answer_message": None, "answer_image_url": None}}
)
async def get_some_messages(self, chat_id: int, message_number_from: int, messages_to_get: int) -> SMessageRawList:
cursor = self.message.find({"visibility": True, "chat_id": chat_id})
@ -52,6 +56,10 @@ class MessageDAO:
{"id": str(message_id)},
{"$set": {"message": new_message, "image_url": new_image_url}}
)
await self.message.update_one(
{"answer_id": str(message_id)},
{"$set": {"answer_message": new_message, "answer_image_url": new_image_url}}
)
async def get_messages_from_ids(self, messages_ids: list[UUID]) -> SMessageRawList:
cursor = self.message.find({"visibility": True, "id": {"$in": [str(message_id) for message_id in messages_ids]}})

View file

@ -3,8 +3,7 @@ from urllib.parse import urljoin
from pydantic import ValidationError
from app.chat.exceptions import UserDontHavePermissionException, UserCanNotReadThisChatException, \
UserAlreadyInChatException
from app.chat.exceptions import UserDontHavePermissionException, UserCanNotReadThisChatException
from app.chat.shemas import SAllowedChats, SChangeData, SPinnedChats, SChat
from app.config import settings
from app.services.redis_service import RedisService

View file

@ -26,15 +26,15 @@ def create_registration_confirmation_template(
<title>Submiting</title>
</head>
<body style="margin: 0;
padding: 0;">
padding: 0;">
<table cellpadding="10" cellspacing="0" width="100%" style="background-color: #101010;">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
</tr>
<tr>
<td align="center">
<div style="
display: flex;