2.2.1 • Published 8 years ago

patchwork-threads v2.2.1

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

patchwork-threads

var threadlib = require('patchwork-threads')

// get the ID of the root message of the thread for any given msg id
threadlib.fetchThreadRootID (ssb, mid, cb)

// get full thread structure
// `opts` used in fetchThreadData
threadlib.getPostThread (ssb, mid, opts, cb)

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

// get a flattened msg-list of the thread, ready for rendering
threadlib.flattenThread (thread)

// replace each msg in a flattened thread with its latest revision
threadlib.reviseFlatThread(ssb, thread, cb)

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

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

// fetch & compute data related to the given thread
// - opts.isRead: attach isread data
// - opts.isBookmarked: attach isBookmarked data
// - opts.votes: compute votes data
threadlib.fetchThreadData (ssb, thread, opts, cb)

// helpers to iterate a thread
threadlib.iterateThread (thread, maxDepth, fn)
threadlib.iterateThreadAsync (thread, maxDepth, fn, cb)

// helpers used in fetchThreadData
threadlib.attachThreadIsread (ssb, thread, maxdepth, cb)
threadlib.attachThreadIsbookmarked (ssb, thread, maxdepth, cb)
threadlib.compileThreadVotes (thread)

// mark all unread msgs in the thread as read
threadlib.markThreadRead (ssb, thread, cb)

// decrypt the msgs in the thread, if not yet decrypted
threadlib.decryptThread (ssb, thread, cb)

// get the last type:post msg in the thread
threadlib.getLastThreadPost (thread)

// get messages that were published as revision to an existing message
threadlib.getRevisions(ssb, thread, callback)

// get the latest revision of an existing message
threadlib.getLatestRevision(ssb, msg, callback)

// count the number of replies in a thread
// - filter(msg): optional additional filter, return bool
threadlib.countReplies(thread, [filter])

// is `a` a reply to `b`?
threadlib.isaReplyTo(a, b)

// does `a` mention `b`?
threadlib.isaMentionTo(a, b)

// does `a` revise `b`?
thread.lib.isaRevisionTo(a, b)
2.2.1

8 years ago

2.2.0

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.8

8 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago