mirror of
https://github.com/openmax-server/server.git
synced 2026-05-22 19:41:41 +03:00
MAX: теперь для избранного не сравниваем айди с нулём
This commit is contained in:
10
src/main.py
10
src/main.py
@@ -4,6 +4,7 @@ import logging
|
||||
import signal
|
||||
import ssl
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from common.config import ServerConfig
|
||||
from common.push import PushService
|
||||
@@ -195,8 +196,13 @@ async def main():
|
||||
# Запускаем контроллеры
|
||||
try:
|
||||
await asyncio.gather(*running_tasks)
|
||||
except (asyncio.CancelledError, Exception):
|
||||
logging.info("Все задачи завершены, выходим")
|
||||
except asyncio.CancelledError:
|
||||
logging.info("Все задачи завершены")
|
||||
except Exception as e:
|
||||
logging.error(
|
||||
f"Произошла неизвестная ошибка: {e}"
|
||||
)
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
if hasattr(db, 'close'):
|
||||
db.close()
|
||||
|
||||
@@ -24,7 +24,7 @@ class HistoryProcessors(BaseProcessor):
|
||||
|
||||
# Если пользователь хочет получить историю из избранного,
|
||||
# то выставляем в качестве ID чата его ID
|
||||
if chatId == 0:
|
||||
if chatId == (senderId ^ senderId):
|
||||
chatId = senderId
|
||||
|
||||
# Проверяем, существует ли чат
|
||||
|
||||
@@ -89,8 +89,7 @@ class MessagesProcessors(BaseProcessor):
|
||||
|
||||
# Если клиент хочет отправить сообщение в избранное,
|
||||
# то выставляем в качестве ID чата ID отправителя
|
||||
# (А ещё используем это, если клиент вообще ничего не указал)
|
||||
if chatId == 0 or not chatId:
|
||||
if chatId == (senderId ^ senderId):
|
||||
chatId = senderId
|
||||
participants = [senderId]
|
||||
else:
|
||||
@@ -144,7 +143,7 @@ class MessagesProcessors(BaseProcessor):
|
||||
participant,
|
||||
{
|
||||
"eventType": "new_msg",
|
||||
"chatId": 0 if chatId == senderId else chatId,
|
||||
"chatId": 0 if chatId == (senderId ^ senderId) else chatId,
|
||||
"message": bodyMessage,
|
||||
"prevMessageId": lastMessageId,
|
||||
"time": messageTime,
|
||||
|
||||
Reference in New Issue
Block a user