ssbc/patchwork-threads

Name: patchwork-threads

Owner: Secure Scuttlebutt Consortium

Description: library of patchwork's thread data-structures

Created: 2015-11-16 02:37:36.0

Updated: 2017-11-25 09:48:56.0

Pushed: 2016-09-28 04:34:49.0

Homepage:

Size: 72

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

patchwork-threads

threadlib = require('patchwork-threads')

et the ID of the root message of the thread for any given msg id
adlib.fetchThreadRootID (ssb, mid, cb)

et full thread structure
opts` used in fetchThreadData
adlib.getPostThread (ssb, mid, opts, cb)

et full thread structure, starting possibly from a reply
opts` used in fetchThreadData
adlib.getParentPostThread (ssb, mid, opts, cb)

et a flattened msg-list of the thread, ready for rendering
adlib.flattenThread (thread)

eplace each msg in a flattened thread with its latest revision
adlib.reviseFlatThread(ssb, thread, cb)

et top-level thread structure (no replies of replies)
opts` used in fetchThreadData
adlib.getPostSummary (ssb, mid, opts, cb)

et top-level thread structure (no replies of replies), starting possibly from a reply
opts` used in fetchThreadData
adlib.getParentPostSummary (ssb, mid, opts, cb)

etch & compute data related to the given thread
 opts.isRead: attach isread data
 opts.isBookmarked: attach isBookmarked data
 opts.votes: compute votes data
adlib.fetchThreadData (ssb, thread, opts, cb)

elpers to iterate a thread
adlib.iterateThread (thread, maxDepth, fn)
adlib.iterateThreadAsync (thread, maxDepth, fn, cb)

elpers used in fetchThreadData
adlib.attachThreadIsread (ssb, thread, maxdepth, cb)
adlib.attachThreadIsbookmarked (ssb, thread, maxdepth, cb)
adlib.compileThreadVotes (thread)

ark all unread msgs in the thread as read
adlib.markThreadRead (ssb, thread, cb)

ecrypt the msgs in the thread, if not yet decrypted
adlib.decryptThread (ssb, thread, cb)

et the last type:post msg in the thread
adlib.getLastThreadPost (thread)

et messages that were published as revision to an existing message
adlib.getRevisions(ssb, thread, callback)

et the latest revision of an existing message
adlib.getLatestRevision(ssb, msg, callback)

ount the number of replies in a thread
 filter(msg): optional additional filter, return bool
adlib.countReplies(thread, [filter])

s `a` a reply to `b`?
adlib.isaReplyTo(a, b)

oes `a` mention `b`?
adlib.isaMentionTo(a, b)

oes `a` revise `b`?
ad.lib.isaRevisionTo(a, b)

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.