aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lib/serve.js15
2 files changed, 16 insertions, 0 deletions
diff --git a/README.md b/README.md
index deb1fa2..423442c 100644
--- a/README.md
+++ b/README.md
@@ -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