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 /lib/serve.js | |
parent | 01ea88684375793b3e009d8cefb9722384e2c88b (diff) | |
download | patchfoo-0ea52b9a188055c1bcf1e256c07251dfdc274a45.tar.gz patchfoo-0ea52b9a188055c1bcf1e256c07251dfdc274a45.zip |
Reply mention feeds
Diffstat (limited to 'lib/serve.js')
-rw-r--r-- | lib/serve.js | 15 |
1 files changed, 15 insertions, 0 deletions
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 |