From 301e319442b212f4442eabab3157bb2f455315cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=9D=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Fri, 28 Nov 2025 14:08:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B4=D0=BB=D1=8F=20=D0=BE=D1=82=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=D0=BA=D0=B8=20403=20=D0=B2=20chat=5Fmark=5Fread?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/communications/views.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/communications/views.py b/backend/communications/views.py index 65b80283..3c59d3cc 100644 --- a/backend/communications/views.py +++ b/backend/communications/views.py @@ -309,7 +309,16 @@ def chat_mark_read(request, pk: int): if c.type == "private": return c.participants.filter(pk=u.pk).exists() if c.type == "department" and c.department_id: - return c.get_participants.filter(pk=u.pk).exists() + has = c.get_participants.filter(pk=u.pk).exists() + # Временное логирование для отладки + import logging + logger = logging.getLogger(__name__) + logger.warning( + f"chat_mark_read access check: chat_id={c.id}, " + f"type={c.type}, dept_id={c.department_id}, " + f"user_id={u.id}, has_access={has}" + ) + return has return False if not has_access(chat, user):