summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorenahum <nahumhbl@gmail.com>2016-08-24 18:10:49 -0300
committerGitHub <noreply@github.com>2016-08-24 18:10:49 -0300
commite6d15f77e8fa4ec27e104297667b28dc5f8517ca (patch)
treeced33e8d5a3571aac144375daea1d4b16b843c37 /webapp
parentdeb1361a0d67421fbeacc466b57c05d10da4c631 (diff)
downloadchat-e6d15f77e8fa4ec27e104297667b28dc5f8517ca.tar.gz
chat-e6d15f77e8fa4ec27e104297667b28dc5f8517ca.tar.bz2
chat-e6d15f77e8fa4ec27e104297667b28dc5f8517ca.zip
PLT-3942 Add real-time updates for center channel profile picture popover (#3871)
* PLT-3942 Add real-time updates for center channel profile picture pop-over * Send user data with the websocket event to prevent further requests * Add helper for profile sanitation
Diffstat (limited to 'webapp')
-rw-r--r--webapp/actions/websocket_actions.jsx11
-rw-r--r--webapp/utils/constants.jsx1
2 files changed, 12 insertions, 0 deletions
diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx
index fb0fbf513..2abc6ebd4 100644
--- a/webapp/actions/websocket_actions.jsx
+++ b/webapp/actions/websocket_actions.jsx
@@ -128,6 +128,10 @@ function handleEvent(msg) {
handleUserRemovedEvent(msg);
break;
+ case SocketEvents.USER_UPDATED:
+ handleUserUpdatedEvent(msg);
+ break;
+
case SocketEvents.CHANNEL_VIEWED:
handleChannelViewedEvent(msg);
break;
@@ -241,6 +245,13 @@ function handleUserRemovedEvent(msg) {
}
}
+function handleUserUpdatedEvent(msg) {
+ if (UserStore.getCurrentId() !== msg.user_id) {
+ UserStore.saveProfile(msg.data.user);
+ UserStore.emitChange(msg.user_id);
+ }
+}
+
function handleChannelViewedEvent(msg) {
// Useful for when multiple devices have the app open to different channels
if (TeamStore.getCurrentId() === msg.team_id &&
diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx
index 8a31f6bfa..60cc82ff6 100644
--- a/webapp/utils/constants.jsx
+++ b/webapp/utils/constants.jsx
@@ -194,6 +194,7 @@ export const Constants = {
LEAVE_TEAM: 'leave_team',
USER_ADDED: 'user_added',
USER_REMOVED: 'user_removed',
+ USER_UPDATED: 'user_updated',
TYPING: 'typing',
PREFERENCE_CHANGED: 'preference_changed',
EPHEMERAL_MESSAGE: 'ephemeral_message',