Ответы и реакции истории, публикации в профиле. Фиксы

This commit is contained in:
Халимов Рустам
2026-03-13 23:34:32 +03:00
parent ca1d88191c
commit 010b96d362
62 changed files with 2365 additions and 189 deletions
+29 -1
View File
@@ -96,7 +96,7 @@ export default function ChatPage() {
}
addMessage(message);
// Play notification sound for messages from others
if (message.senderId !== user?.id && !isChatMuted(message.chatId)) {
if (message.senderId !== user?.id && !message.storyId && !isChatMuted(message.chatId)) {
playNotificationSound();
}
});
@@ -219,6 +219,31 @@ export default function ChatPage() {
setCallOpen(true);
});
// Story events - registered globally so they work even when StoryViewer is closed
socket.on('story_viewed', (data: { storyId: string; userId: string; username: string; displayName: string; avatar: string | null; viewedAt: string; viewCount: number; ownerId: string }) => {
console.log('[Socket] story_viewed received:', data);
// Only process if this user is the owner
if (data.ownerId === user?.id) {
console.log('[Socket] This is my story, updating view count');
}
});
socket.on('story_reply', (data: { storyId: string; userId: string; username: string; displayName: string; avatar: string | null; content: string; createdAt: string; ownerId: string }) => {
console.log('[Socket] story_reply received:', data);
// Only process if this user is the owner
if (data.ownerId === user?.id) {
console.log('[Socket] This is my story, got reply:', data.content);
}
});
socket.on('story_reaction', (data: { storyId: string; userId: string; username: string; displayName: string; avatar: string | null; emoji: string; createdAt: string; ownerId: string }) => {
console.log('[Socket] story_reaction received:', data);
// Only process if this user is the owner
if (data.ownerId === user?.id) {
console.log('[Socket] This is my story, got reaction:', data.emoji);
}
});
return () => {
socket.off('new_message');
socket.off('scheduled_delivered');
@@ -237,6 +262,9 @@ export default function ChatPage() {
socket.off('message_pinned');
socket.off('message_unpinned');
socket.off('call_incoming');
socket.off('story_viewed');
socket.off('story_reply');
socket.off('story_reaction');
};
}, [user?.id]);