git ssb

4+

Dominic / scuttlebot



Commit f6e2d256794d075ec47526344d41a008b5a814bd

Merge branch 'rmRelatedmessages'

Dominic Tarr committed on 8/10/2018, 6:33:44 AM
Parent: a6a68e420db6fa2dc9bc79f5c8babc18c0308799
Parent: fdc7aa8c33b9639e96b202b3cbe202350b53bcc5

Files changed

api.mdchanged
index.jschanged
lib/validators.jschanged
api.mdView
@@ -198,46 +198,8 @@
198198 - `keys` (boolean, default: `true`): whether the `data` event should contain keys. If set to `true` and `values` set to `false` then `data` events will simply be keys, rather than objects with a `key` property.
199199 - `values` (boolean, default: `true`): whether the `data` event should contain values. If set to `true` and `keys` set to `false` then `data` events will simply be values, rather than objects with a `value` property.
200200
201201
202-
203-## relatedMessages: async
204-
205-Retrieve the tree of messages related to the given id.
206-
207-```bash
208-relatedMessages --id {msgid} [--rel value] [--count] [--parent]
209-```
210-
211-```js
212-relatedMessages ({ id:, rel:, count:, parent: }, cb)
213-```
214-
215-This is ideal for collecting things like threaded replies.
216-The output is a recursive structure like this:
217-
218-``` js
219-{
220- key: <id>,
221- value: <msg>,
222- related: [
223- <recursive>,...
224- ],
225- //number of messages below this point. (when opts.count = true)
226- count: <int>,
227- //the message this message links to. this will not appear on the bottom level.
228- //(when opts.parent = true)
229- parent: <parent_id>
230-}
231-```
232-
233- - `id` (MsgID): Root message, fetches messages related message to its ID.
234- - `rel` (string, optional): Filters the links by the relation string.
235- - `count` (boolean, default: `false`): Include a `count` of each message's decendant messages.
236- - `parent` (boolean, default: `false`): Include the `parent` id of each message.
237-
238-
239-
240202 ## add: async
241203
242204 Add a well-formed message to the database.
243205
index.jsView
@@ -122,9 +122,8 @@
122122 getLatest : valid.async(ssb.getLatest, 'feedId'),
123123 latestSequence : valid.async(ssb.latestSequence, 'feedId'),
124124 createFeed : ssb.createFeed,
125125 whoami : function () { return { id: feed.id } },
126- relatedMessages : valid.async(ssb.relatedMessages, 'relatedMessagesOpts'),
127126 query : ssb.query,
128127 createFeedStream : valid.source(ssb.createFeedStream, 'readStreamOpts?'),
129128 createHistoryStream : valid.source(ssb.createHistoryStream, ['createHistoryStreamOpts'], ['feedId', 'number?', 'boolean?']),
130129 createLogStream : valid.source(ssb.createLogStream, 'readStreamOpts?'),
lib/validators.jsView
@@ -185,30 +185,8 @@
185185 if (v.values && typeof v.values != 'boolean' && typeof v.values != 'number')
186186 return AttrType(n, 'values', 'boolean')
187187 },
188188
189- relatedMessagesOpts: function (v, n) {
190- var err = this.get('object')(v, n)
191- if (err)
192- return err
193-
194- // .id
195- if (!ref.isMsg(v.id))
196- return MissingAttr(n, 'id', 'msgId')
197-
198- // .rel
199- if (v.rel && typeof v.rel != 'string')
200- return AttrType(n, 'rel', 'string')
201-
202- // .count
203- if (v.count && typeof v.count != 'boolean' && typeof v.count != 'number')
204- return AttrType(n, 'count', 'boolean')
205-
206- // .parent
207- if (v.parent && typeof v.parent != 'boolean' && typeof v.parent != 'number')
208- return AttrType(n, 'parent', 'boolean')
209- },
210-
211189 isBlockedOpts: function (v, n) {
212190 var err = this.get('object')(v, n)
213191 if (err)
214192 return err

Built with git-ssb-web