From c327d9a1c50a206934d8fd2465fcc9fa419f7249 Mon Sep 17 00:00:00 2001 From: Beng Tan Date: Thu, 11 Jul 2019 15:57:37 +0800 Subject: [PATCH 1/2] Update own profile's presence status. Reverts part of c050a82a. --- third-party/wocky-client/src/store/Wocky.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/third-party/wocky-client/src/store/Wocky.ts b/third-party/wocky-client/src/store/Wocky.ts index 942906e75..a1a1bcbbc 100644 --- a/third-party/wocky-client/src/store/Wocky.ts +++ b/third-party/wocky-client/src/store/Wocky.ts @@ -450,13 +450,10 @@ export const Wocky = types reaction( () => self.transport.presence, ({id, status}) => { - // no need to update own profile's status - if (id !== self.username) { - const profile = self.profiles.get(id) - profile.setStatus(status) - if (profile.isOwn && self.profile) { - self.profile!.setStatus(status) - } + const profile = self.profiles.get(id) + profile.setStatus(status) + if (profile.isOwn && self.profile) { + self.profile!.setStatus(status) } } ), From e6a726760a14f41ff1e29b4becdb33838dc7b3a0 Mon Sep 17 00:00:00 2001 From: aksonov Date: Fri, 26 Jul 2019 18:12:31 +0300 Subject: [PATCH 2/2] implement new presence data --- third-party/wocky-client/src/transport/Transport.ts | 8 ++++++++ third-party/wocky-client/src/transport/constants.ts | 5 ++++- third-party/wocky-client/src/transport/utils.ts | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/third-party/wocky-client/src/transport/Transport.ts b/third-party/wocky-client/src/transport/Transport.ts index efc89e6ee..9b5508690 100644 --- a/third-party/wocky-client/src/transport/Transport.ts +++ b/third-party/wocky-client/src/transport/Transport.ts @@ -934,6 +934,10 @@ export class Transport { firstName lastName handle + presence { + status + updatedAt + } media { thumbnailUrl trosUrl @@ -1226,6 +1230,10 @@ export class Transport { firstName lastName handle + presence { + status + updatedAt + } media { thumbnailUrl trosUrl diff --git a/third-party/wocky-client/src/transport/constants.ts b/third-party/wocky-client/src/transport/constants.ts index 745f94981..13006e54c 100644 --- a/third-party/wocky-client/src/transport/constants.ts +++ b/third-party/wocky-client/src/transport/constants.ts @@ -3,7 +3,10 @@ export const AREA_TOO_LARGE = 'AREA_TOO_LARGE' export const PROFILE_PROPS = `id firstName lastName handle media { thumbnailUrl fullUrl trosUrl } bots(first:0, relationship: OWNED) { totalCount } - presenceStatus + presence { + status + updatedAt + } ` export const BOT_PROPS = `id icon title address addressData description radius shortname diff --git a/third-party/wocky-client/src/transport/utils.ts b/third-party/wocky-client/src/transport/utils.ts index ad215c1ef..0e267c828 100644 --- a/third-party/wocky-client/src/transport/utils.ts +++ b/third-party/wocky-client/src/transport/utils.ts @@ -300,11 +300,11 @@ export function convertImage(image) { return image && image.trosUrl ? {id: image.trosUrl, url: image.thumbnailUrl} : null } -export function convertProfile({media, bots, presenceStatus, ...data}): IProfilePartial { +export function convertProfile({media, bots, presence, ...data}): IProfilePartial { // console.log('convertProfile', bots, followers, followed, data) return { avatar: convertImage(media), - status: presenceStatus, + status: presence.status, botsSize: bots ? bots.totalCount : undefined, ...data, } as IProfilePartial