Skip to content

Commit

Permalink
Merge pull request #3908 from hippware/3874-own-presence
Browse files Browse the repository at this point in the history
Update own profile's presence status.
  • Loading branch information
bengtan committed Jul 29, 2019
2 parents 5a553ff + e6a7267 commit 8770c61
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
11 changes: 4 additions & 7 deletions third-party/wocky-client/src/store/Wocky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
),
Expand Down
8 changes: 8 additions & 0 deletions third-party/wocky-client/src/transport/Transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,10 @@ export class Transport {
firstName
lastName
handle
presence {
status
updatedAt
}
media {
thumbnailUrl
trosUrl
Expand Down Expand Up @@ -1244,6 +1248,10 @@ export class Transport {
firstName
lastName
handle
presence {
status
updatedAt
}
media {
thumbnailUrl
trosUrl
Expand Down
5 changes: 4 additions & 1 deletion third-party/wocky-client/src/transport/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions third-party/wocky-client/src/transport/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8770c61

Please sign in to comment.