feat(platform): contacts block/unblock spans and activeChannelId (Phase 546)
Add contacts.block and contacts.unblock spans; extend request, accept, and decline span ends with activeChannelId metadata. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -45,6 +45,8 @@ Expose a single `EventEmitter` API the UI drives over IPC (`apps/pearcord/index.
|
|||||||
|
|
||||||
**v0.8.452 (Phase 489):** `slash.register` `customCount`; `slash.delete` `deleted`; `slash.invoke` `replyLen`/`commandFound`. UI slash compositor + hints. Bundle: `npm run test:phase489-slash`. See [SLASH_COMMANDS.md](../../docs/SLASH_COMMANDS.md).
|
**v0.8.452 (Phase 489):** `slash.register` `customCount`; `slash.delete` `deleted`; `slash.invoke` `replyLen`/`commandFound`. UI slash compositor + hints. Bundle: `npm run test:phase489-slash`. See [SLASH_COMMANDS.md](../../docs/SLASH_COMMANDS.md).
|
||||||
|
|
||||||
|
**v0.8.509 (Phase 546):** Contacts spans extend — `contacts.block`/`contacts.unblock` spans; `activeChannelId` on request/accept/decline/block/unblock ends; split contacts panel compositor; **contacts-errors** includes block/unblock. Bundle: `npm run test:phase546-contacts`. See [CONTACTS.md](../../docs/CONTACTS.md).
|
||||||
|
|
||||||
**v0.8.508 (Phase 545):** Discovery spans extend — `discovery.prune` span; `activeChannelId` on `discovery.list`/`publish`/`mesh`/`prune` ends; split discovery panel compositor; **discovery-errors** includes `prune`. Bundle: `npm run test:phase545-discovery`. See [DISCOVERY.md](../../docs/DISCOVERY.md).
|
**v0.8.508 (Phase 545):** Discovery spans extend — `discovery.prune` span; `activeChannelId` on `discovery.list`/`publish`/`mesh`/`prune` ends; split discovery panel compositor; **discovery-errors** includes `prune`. Bundle: `npm run test:phase545-discovery`. See [DISCOVERY.md](../../docs/DISCOVERY.md).
|
||||||
|
|
||||||
**v0.8.507 (Phase 544):** Presence spans extend — `presence.image` span for activity artwork; `activeChannelId` on `presence.set`/`presence.activity`/`presence.image` ends; split presence panel compositor; **presence-errors** includes `image`. Bundle: `npm run test:phase544-presence`. See [PRESENCE.md](../../docs/PRESENCE.md).
|
**v0.8.507 (Phase 544):** Presence spans extend — `presence.image` span for activity artwork; `activeChannelId` on `presence.set`/`presence.activity`/`presence.image` ends; split presence panel compositor; **presence-errors** includes `image`. Bundle: `npm run test:phase544-presence`. See [PRESENCE.md](../../docs/PRESENCE.md).
|
||||||
|
|||||||
@@ -1283,7 +1283,8 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
peerUserId: peerUserId || null,
|
peerUserId: peerUserId || null,
|
||||||
peerDisplayNameLen: String(peerDisplayName || '').trim().length,
|
peerDisplayNameLen: String(peerDisplayName || '').trim().length,
|
||||||
pendingOutCount: pendingOut.length,
|
pendingOutCount: pendingOut.length,
|
||||||
acceptedCount: accepted.length
|
acceptedCount: accepted.length,
|
||||||
|
activeChannelId: this.activeChannelId
|
||||||
})
|
})
|
||||||
return row
|
return row
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -1312,7 +1313,8 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
peerUserId: peerUserId || null,
|
peerUserId: peerUserId || null,
|
||||||
accepted: row?.status === 'accepted' || row?.status === 'friend',
|
accepted: row?.status === 'accepted' || row?.status === 'friend',
|
||||||
acceptedCount: accepted.length,
|
acceptedCount: accepted.length,
|
||||||
pendingInCount: pendingIn.length
|
pendingInCount: pendingIn.length,
|
||||||
|
activeChannelId: this.activeChannelId
|
||||||
})
|
})
|
||||||
return row
|
return row
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -1340,7 +1342,8 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
peerUserId: peerUserId || null,
|
peerUserId: peerUserId || null,
|
||||||
declined: true,
|
declined: true,
|
||||||
pendingInCount: pendingIn.length,
|
pendingInCount: pendingIn.length,
|
||||||
pendingOutCount: pendingOut.length
|
pendingOutCount: pendingOut.length,
|
||||||
|
activeChannelId: this.activeChannelId
|
||||||
})
|
})
|
||||||
return row
|
return row
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -1361,12 +1364,54 @@ class PearcordPlatform extends EventEmitter {
|
|||||||
async blockContact (peerUserId) {
|
async blockContact (peerUserId) {
|
||||||
if (!this.contacts) await this._joinContactsMesh()
|
if (!this.contacts) await this._joinContactsMesh()
|
||||||
if (!this.contacts) throw new Error('contacts unavailable')
|
if (!this.contacts) throw new Error('contacts unavailable')
|
||||||
return this.contacts.blockContact(peerUserId)
|
const span = this.log.time('contacts.block', {
|
||||||
|
spanKind: 'contacts.block',
|
||||||
|
peerUserId: peerUserId || null
|
||||||
|
})
|
||||||
|
try {
|
||||||
|
const row = await this.contacts.blockContact(peerUserId)
|
||||||
|
const blocked = await this.contacts.listBlocked()
|
||||||
|
span.end({
|
||||||
|
spanKind: 'contacts.block',
|
||||||
|
peerUserId: peerUserId || null,
|
||||||
|
blockedCount: blocked.length,
|
||||||
|
activeChannelId: this.activeChannelId
|
||||||
|
})
|
||||||
|
return row
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error('contacts.block error', {
|
||||||
|
peerUserId,
|
||||||
|
error: err?.message || String(err)
|
||||||
|
})
|
||||||
|
span.fail(err)
|
||||||
|
throw err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async unblockContact (peerUserId) {
|
async unblockContact (peerUserId) {
|
||||||
if (!this.contacts) throw new Error('contacts unavailable')
|
if (!this.contacts) throw new Error('contacts unavailable')
|
||||||
return this.contacts.unblockContact(peerUserId)
|
const span = this.log.time('contacts.unblock', {
|
||||||
|
spanKind: 'contacts.unblock',
|
||||||
|
peerUserId: peerUserId || null
|
||||||
|
})
|
||||||
|
try {
|
||||||
|
const row = await this.contacts.unblockContact(peerUserId)
|
||||||
|
const blocked = await this.contacts.listBlocked()
|
||||||
|
span.end({
|
||||||
|
spanKind: 'contacts.unblock',
|
||||||
|
peerUserId: peerUserId || null,
|
||||||
|
blockedCount: blocked.length,
|
||||||
|
activeChannelId: this.activeChannelId
|
||||||
|
})
|
||||||
|
return row
|
||||||
|
} catch (err) {
|
||||||
|
this.log.error('contacts.unblock error', {
|
||||||
|
peerUserId,
|
||||||
|
error: err?.message || String(err)
|
||||||
|
})
|
||||||
|
span.fail(err)
|
||||||
|
throw err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async listContacts () {
|
async listContacts () {
|
||||||
|
|||||||
Reference in New Issue
Block a user