feat(notifications): per-chat mute settings
Some checks failed
CI / test (push) Failing after 18s

- add chat_notification_settings table and migration
- add chat notifications API (get/update muted)
- skip message notifications for muted recipients
- add mute/unmute control in chat info panel
This commit is contained in:
2026-03-08 02:17:09 +03:00
parent eddd4bda0b
commit ea8a50ee05
9 changed files with 238 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ import re
from sqlalchemy.ext.asyncio import AsyncSession
from app.chats.repository import list_chat_members
from app.chats.repository import is_chat_muted_for_user, list_chat_members
from app.messages.models import Message
from app.notifications.repository import create_notification_log, list_user_notifications
from app.notifications.schemas import NotificationRead, NotificationRequest
@@ -44,6 +44,8 @@ async def dispatch_message_notifications(db: AsyncSession, message: Message) ->
sender_name = sender_users[0].username if sender_users else "Someone"
for recipient in users:
if await is_chat_muted_for_user(db, chat_id=message.chat_id, user_id=recipient.id):
continue
base_payload = {
"chat_id": message.chat_id,
"message_id": message.id,