From 63b9d0c20fa2a26e783a138c9e5b98b4cfca3230 Mon Sep 17 00:00:00 2001 From: cel Date: Thu, 29 Aug 2019 12:12:27 -0700 Subject: Include content warning in post title --- lib/render-msg.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/render-msg.js') diff --git a/lib/render-msg.js b/lib/render-msg.js index b8e0123..82395af 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -485,10 +485,13 @@ RenderMsg.prototype.title1 = function (cb) { if (!self.c || typeof self.c !== 'object') { cb(null, self.msg.key) } else if (typeof self.c.text === 'string') { + var text = typeof self.c.contentWarning === 'string' ? + '[CW: ' + self.c.contentWarning + ']\n\n' + self.c.text : + self.c.text if (self.c.type === 'post') - cb(null, title(self.c.text) || '…') + cb(null, title(text) || '…') else - cb(null, '%' + self.c.type + ': ' + (self.c.title || title(self.c.text))) + cb(null, '%' + self.c.type + ': ' + (self.c.title || title(text))) } else { if (self.c.type === 'ssb-dns') cb(null, self.c.record && JSON.stringify(self.c.record.data) || self.msg.key) -- cgit v1.2.3