feat(contacts): friend presence activity on PRESENCE_UPDATE gossip
Persist and broadcast optional activity on contact mesh presence rows so friends see Now Playing state P2P alongside custom status. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -7,6 +7,7 @@ const b4a = require('b4a')
|
||||
const { JsonStore } = require('pearcord-db/store-json')
|
||||
const { RPC, contactsTopic, topicToBuffer, id, now, USER_STATUS } = require('pearcord-shared')
|
||||
const { attachContactsMesh, broadcastContactsGossip } = require('./mesh')
|
||||
const { normalizeActivity } = require('pearcord-activity')
|
||||
|
||||
const CONTACTS_COLLECTION = '@pearcord/contacts'
|
||||
|
||||
@@ -296,6 +297,7 @@ class PearcordContacts extends EventEmitter {
|
||||
userId: payload.userId,
|
||||
status: payload.status || USER_STATUS.ONLINE,
|
||||
customStatus: payload.customStatus || null,
|
||||
activity: normalizeActivity(payload.activity),
|
||||
at: payload.at || now()
|
||||
}
|
||||
this._friendPresence.set(payload.userId, row)
|
||||
@@ -309,6 +311,7 @@ class PearcordContacts extends EventEmitter {
|
||||
userId: payload.userId,
|
||||
status: payload.status || USER_STATUS.ONLINE,
|
||||
customStatus: payload.customStatus || null,
|
||||
activity: normalizeActivity(payload.activity),
|
||||
at: payload.at || now()
|
||||
}
|
||||
if (this._meshJoined) {
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@
|
||||
"protomux": "^3.0.0",
|
||||
"pearcord-db": "file:../pearcord-db",
|
||||
"pearcord-drive": "file:../pearcord-drive",
|
||||
"pearcord-shared": "file:../pearcord-shared"
|
||||
"pearcord-shared": "file:../pearcord-shared",
|
||||
"pearcord-activity": "file:../pearcord-activity"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user