diff --git a/app/containers/Avatar/index.tsx b/app/containers/Avatar/index.tsx index f924e5435..6b658ac83 100644 --- a/app/containers/Avatar/index.tsx +++ b/app/containers/Avatar/index.tsx @@ -26,8 +26,9 @@ const AvatarContainer = ({ getCustomEmoji, isStatic, rid, - handleEdit -}: IAvatar & { handleEdit?: () => void }): React.ReactElement => { + handleEdit, + isUserProfile +}: IAvatar & { isUserProfile?: boolean; handleEdit?: () => void }): React.ReactElement => { const subscription = useRef(); const [avatarETag, setAvatarETag] = useState(''); const { colors } = useTheme(); @@ -36,10 +37,11 @@ const AvatarContainer = ({ const server = useSelector((state: IApplicationState) => state.share.server.server || state.server.server); const serverVersion = useSelector((state: IApplicationState) => state.share.server.version || state.server.version); - const { id, token } = useSelector( + const { id, token, avatarETagUser } = useSelector( (state: IApplicationState) => ({ id: getUserSelector(state).id, - token: getUserSelector(state).token + token: getUserSelector(state).token, + avatarETagUser: getUserSelector(state).avatarETag }), shallowEqual ); @@ -110,7 +112,7 @@ const AvatarContainer = ({ rid={rid} blockUnauthenticatedAccess={blockUnauthenticatedAccess} externalProviderUrl={externalProviderUrl} - avatarETag={avatarETag} + avatarETag={isUserProfile ? avatarETagUser : avatarETag} serverVersion={serverVersion} /> {handleEdit ? ( diff --git a/app/lib/methods/subscriptions/rooms.ts b/app/lib/methods/subscriptions/rooms.ts index 5bbeffe3d..7c80e37f5 100644 --- a/app/lib/methods/subscriptions/rooms.ts +++ b/app/lib/methods/subscriptions/rooms.ts @@ -288,7 +288,7 @@ export default function subscribeRooms() { const [type, data] = ddpMessage.fields.args; const [, ev] = ddpMessage.fields.eventName.split('/'); if (/userData/.test(ev)) { - const [{ diff }] = ddpMessage.fields.args; + const [{ diff, unset }] = ddpMessage.fields.args; if (diff?.statusLivechat) { store.dispatch(setUser({ statusLivechat: diff.statusLivechat })); } @@ -298,6 +298,12 @@ export default function subscribeRooms() { if ((['settings.preferences.alsoSendThreadToChannel'] as any) in diff) { store.dispatch(setUser({ alsoSendThreadToChannel: diff['settings.preferences.alsoSendThreadToChannel'] })); } + if (diff?.avatarETag) { + store.dispatch(setUser({ avatarETag: diff.avatarETag })); + } + if (unset?.avatarETag) { + store.dispatch(setUser({ avatarETag: '' })); + } } if (/subscriptions/.test(ev)) { if (type === 'removed') { diff --git a/app/views/ChangeAvatarView/index.tsx b/app/views/ChangeAvatarView/index.tsx index 502d21f02..5719c6a22 100644 --- a/app/views/ChangeAvatarView/index.tsx +++ b/app/views/ChangeAvatarView/index.tsx @@ -158,11 +158,17 @@ const ChangeAvatarView = () => { {...scrollPersistTaps} > - + setAvatar({ url: value, data: value, service: 'url' })} /> - {fromUser && avatarSuggestions.length ? ( + {fromUser ? ( ) : null} diff --git a/app/views/ProfileView/index.tsx b/app/views/ProfileView/index.tsx index e3e40cce4..4647686d0 100644 --- a/app/views/ProfileView/index.tsx +++ b/app/views/ProfileView/index.tsx @@ -413,8 +413,10 @@ class ProfileView extends React.Component { > - +