diff --git a/backend/communications/api/serializers.py b/backend/communications/api/serializers.py index c15b048b..ab22096c 100644 --- a/backend/communications/api/serializers.py +++ b/backend/communications/api/serializers.py @@ -3,12 +3,12 @@ Serializers for Communications API """ from rest_framework import serializers from django.contrib.auth import get_user_model -from communications.models import ( +from ..models import ( Chat, Message, MessageAttachment, MessageReaction, Poll, PollOption, PollVote, ChatMembership, ChatUserSettings ) -from communications.serialization import serialize_message +from ..serialization import serialize_message Employee = get_user_model() diff --git a/backend/communications/api/viewsets.py b/backend/communications/api/viewsets.py index 3ee788ae..ed0d156f 100644 --- a/backend/communications/api/viewsets.py +++ b/backend/communications/api/viewsets.py @@ -19,12 +19,12 @@ from datetime import timezone as dt_tz from asgiref.sync import async_to_sync from channels.layers import get_channel_layer -from communications.models import (Chat, ChatMembership, ChatReadState, +from ..models import (Chat, ChatMembership, ChatReadState, ChatUserSettings, Message, MessageAttachment, MessageReaction, Poll, PollOption, PollVote) from communications.serialization import serialize_message -from communications.utils import _coerce_ts, user_can_access_chat +from ..utils import _coerce_ts, user_can_access_chat from django.contrib.auth import get_user_model from django.db import transaction from django.db.models import Count, Exists, OuterRef, Prefetch, Q, Subquery diff --git a/backend/communications/notifications/handlers.py b/backend/communications/notifications/handlers.py index 11a4e586..a256bab1 100644 --- a/backend/communications/notifications/handlers.py +++ b/backend/communications/notifications/handlers.py @@ -71,7 +71,7 @@ def notify_new_message(message): # Получаем всех участников чата кроме автора if chat.type in ['announcement', 'channel', 'department', 'global']: - participants = chat.get_participants.exclude(id=author.id) + participants = chat.get_participants().exclude(id=author.id) else: participants = chat.participants.exclude(id=author.id) diff --git a/backend/communications/signals.py b/backend/communications/signals.py index f0d947c2..df1889ab 100644 --- a/backend/communications/signals.py +++ b/backend/communications/signals.py @@ -123,7 +123,7 @@ def increment_unread_count_on_new_message(sender, instance, created, **kwargs): try: # Получаем всех участников чата chat = instance.chat - participants = chat.get_participants.exclude(id=instance.author_id) + participants = chat.get_participants().exclude(id=instance.author_id) # Инкрементируем счетчик для существующих ChatReadState # Только для тех, кто еще не прочитал это сообщение