-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
To save storage and for privacy.
Note that this doesn't delete every message related to the group, there are also the group feed announce messages, and member addition messages. We don't want to delete those messages, but we want to delete their secrets. That's a different issue though #103
This came up in #101 (not super relevant though)
The code might look a bit something like this
diff --git a/index.js b/index.js
index 3d574f6..772e891 100644
--- a/index.js
+++ b/index.js
@@ -503,7 +508,26 @@ module.exports = {
pull.drain(
(msg) => {
const groupId = msg.value.content.recps[0]
- ssb.box2.excludeGroupInfo(groupId, null)
+ get(groupId, (err, groupInfo) => {
+ // prettier-ignore
+ if (err) return cb(clarify(err, 'todo'))
+
+ pull(
+ ssb.metafeeds.branchStream({ old: true, live: false }),
+ // get all leaf feeds
+ pull.filter((branch) => branch.length === 4),
+ pull.map((branch) => branch[3]),
+ // get all feeds for this epoch
+ pull.filter(
+ (feed) =>
+ feed.purpose === groupInfo.writeKey.key.toString('base64')
+ )
+ )
+ ssb.box2.excludeGroupInfo(groupId, (err) => {
+ // prettier-ignore
+ if (err) return cb(clarify(err, 'Error on excluding group info after finding exclusion of ourselves'))
+ })
+ })
},
(err) => {
// prettier-ignorewould have to move the excludeGroupInfo into a drain in the pull. And in the drain we'd delete the feeds safely using https://github.com/ssbc/ssb-db2#deletefeedfeedid-cb
Metadata
Metadata
Assignees
Labels
No labels