diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-12-05 17:55:54 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-12-07 16:48:50 -1000 |
commit | 0ea52b9a188055c1bcf1e256c07251dfdc274a45 (patch) | |
tree | 3efcbf02fedb759c17cf78e036686faf3286f7ae | |
parent | 01ea88684375793b3e009d8cefb9722384e2c88b (diff) | |
download | patchfoo-0ea52b9a188055c1bcf1e256c07251dfdc274a45.tar.gz patchfoo-0ea52b9a188055c1bcf1e256c07251dfdc274a45.zip |
Reply mention feeds
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | lib/serve.js | 15 |
2 files changed, 16 insertions, 0 deletions
@@ -135,6 +135,7 @@ To make config options persistent, set them in `~/.ssb/config`, e.g.: - `draftsDir: name of directory in patchfoo's directory (as set by `patchfoo.dir` config option above) to use for message draft data. default: `"drafts"`. - `newLimit: limit of messages to show on `/new` page. Default: 500. Overridable with query string parameter `limit=...`. - `dualMarkdownPreview`: Preview messages in composer in multiple SSB markdown implementations, `ssb-marked` and `ssb-markdown` >= 3. Overridable with query string parameter `dualMd=1`. +- `replyMentionFeeds`: Mention thread branch authors in "reply" property, like Patchwork. Default `true`. ## TODO diff --git a/lib/serve.js b/lib/serve.js index d9df589..f037783 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -116,6 +116,9 @@ Serve.prototype.go = function () { } } + this.replyMentionFeeds = conf.replyMentionFeeds == null ? true : + Boolean(conf.replyMentionFeeds) + if (this.req.method === 'POST' || this.req.method === 'PUT') { if (/^multipart\/form-data/.test(this.req.headers['content-type'])) { var data = {} @@ -3893,6 +3896,18 @@ Serve.prototype.composer = function (opts, cb) { } ] } + + if (self.replyMentionFeeds && links && content.branch) { + var reply = {} + var ids = {} + u.toArray(content.branch).forEach(function (branch) { + ids[branch] = true + }) + links.forEach(function (link) { + if (ids[link.key]) reply[link.key] = link.value.author + }) + if (Object.keys(reply).length > 0) content.reply = reply + } if (data.content_warning) content.contentWarning = String(data.content_warning) if (channel) content.channel = data.channel |