Skip to content

Commit f2c4a1a

Browse files
Enhance notifications for profile updates
1 parent ceb33c1 commit f2c4a1a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/api/v1/profiles/profiles.router.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ profilesRouter.patch('/', Validators.authValidator, async (req, res) => {
4343
res.json(updatedProfile).on('finish', () => {
4444
const { tangible, visible } = updates;
4545
const { id: profileId } = updatedProfile;
46-
if (tangible !== undefined) io.volatile.except(profileId).emit('chats:updated');
46+
io.except(profileId).emit('profiles:updated');
47+
io.except(profileId).emit(`profile:updated:${profileId}`);
48+
io.except(profileId).emit('profile:updated', profileId);
4749
if (visible !== undefined) {
48-
io.volatile.except(profileId).emit(`${visible ? 'online' : 'offline'}:${profileId}`);
50+
io.except(profileId).emit(`${visible ? 'online' : 'offline'}:${profileId}`);
51+
}
52+
if (tangible !== undefined) {
53+
io.except(profileId).emit('chats:updated');
4954
}
5055
});
5156
});

0 commit comments

Comments
 (0)