feat(platform): DM session rekey notice and contact avatarHash
Set dmSessionRekey on group participant change, expose in view, clearDmSessionRekeyNotice API, enrich listContacts with mesh avatarHash.
This commit is contained in:
@@ -347,6 +347,7 @@ class PearcordPlatform extends EventEmitter {
|
||||
this.soundboardRegistry = null
|
||||
this.guildRoles = null
|
||||
this._activeChannelOpenLastReadAt = 0
|
||||
this._dmSessionRekeyNotice = null
|
||||
this.channelPermissions = null
|
||||
this._recentSoundPlays = []
|
||||
this.botEvents = null
|
||||
@@ -1846,6 +1847,11 @@ class PearcordPlatform extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
clearDmSessionRekeyNotice () {
|
||||
this._dmSessionRekeyNotice = null
|
||||
return true
|
||||
}
|
||||
|
||||
async addGroupDmMember ({ channelId, peerUserId }) {
|
||||
const span = this.log.time('dm.group.add-member', {
|
||||
spanKind: 'dm.group.add-member',
|
||||
@@ -1862,6 +1868,14 @@ class PearcordPlatform extends EventEmitter {
|
||||
participantIds: channel.participantIds
|
||||
})
|
||||
this.emit('dm', channel)
|
||||
if (channel.id && channelId && channel.id !== channelId) {
|
||||
this._dmSessionRekeyNotice = {
|
||||
channelId: channel.id,
|
||||
previousChannelId: channelId,
|
||||
at: Date.now(),
|
||||
reason: 'group-participant-change'
|
||||
}
|
||||
}
|
||||
span.end({
|
||||
spanKind: 'dm.group.add-member',
|
||||
channelId: channel.id,
|
||||
@@ -1897,6 +1911,14 @@ class PearcordPlatform extends EventEmitter {
|
||||
participantIds: channel.participantIds
|
||||
})
|
||||
this.emit('dm', channel)
|
||||
if (channel.id && channelId && channel.id !== channelId) {
|
||||
this._dmSessionRekeyNotice = {
|
||||
channelId: channel.id,
|
||||
previousChannelId: channelId,
|
||||
at: Date.now(),
|
||||
reason: 'group-participant-change'
|
||||
}
|
||||
}
|
||||
span.end({
|
||||
spanKind: 'dm.group.remove-member',
|
||||
channelId: channel.id,
|
||||
@@ -2555,6 +2577,7 @@ class PearcordPlatform extends EventEmitter {
|
||||
presence: presenceMap[f.peerUserId]?.status || 'offline',
|
||||
customStatus: presenceMap[f.peerUserId]?.customStatus || null,
|
||||
activity: presenceMap[f.peerUserId]?.activity || null,
|
||||
avatarHash: presenceMap[f.peerUserId]?.avatarHash || f.avatarHash || null,
|
||||
mutualGuildCount: await this._mutualGuildCount(f.peerUserId)
|
||||
})
|
||||
}
|
||||
@@ -20009,6 +20032,7 @@ class PearcordPlatform extends EventEmitter {
|
||||
connected: false,
|
||||
peerCount: 0
|
||||
},
|
||||
dmSessionRekey: this._dmSessionRekeyNotice,
|
||||
dmPeer: this._dmPeerId(),
|
||||
dmTitle: this.dm?.channel?.name || null,
|
||||
dmIsGroup: !!this.dm?.channel?.isGroup,
|
||||
|
||||
Reference in New Issue
Block a user