feat: realtime sync, settings UX and chat list improvements
Some checks failed
CI / test (push) Failing after 21s
Some checks failed
CI / test (push) Failing after 21s
- add chat_updated realtime event and dynamic chat subscriptions - auto-join invite links in web app - implement Telegram-like settings panel (general/notifications/privacy) - add browser notification preferences and keyboard send mode - improve chat list with last message preview/time and online badge - rework chat members UI with context actions and role crowns
This commit is contained in:
@@ -237,6 +237,29 @@ async def get_unread_count_for_chat(db: AsyncSession, *, chat_id: int, user_id:
|
||||
return int(result.scalar_one() or 0)
|
||||
|
||||
|
||||
async def get_last_visible_message_for_user(
|
||||
db: AsyncSession,
|
||||
*,
|
||||
chat_id: int,
|
||||
user_id: int,
|
||||
) -> Message | None:
|
||||
stmt = (
|
||||
select(Message)
|
||||
.outerjoin(
|
||||
MessageHidden,
|
||||
(MessageHidden.message_id == Message.id) & (MessageHidden.user_id == user_id),
|
||||
)
|
||||
.where(
|
||||
Message.chat_id == chat_id,
|
||||
MessageHidden.id.is_(None),
|
||||
)
|
||||
.order_by(Message.id.desc())
|
||||
.limit(1)
|
||||
)
|
||||
result = await db.execute(stmt)
|
||||
return result.scalar_one_or_none()
|
||||
|
||||
|
||||
async def get_chat_notification_setting(
|
||||
db: AsyncSession, *, chat_id: int, user_id: int
|
||||
) -> ChatNotificationSetting | None:
|
||||
|
||||
Reference in New Issue
Block a user