From 552d2797bbc61a5a2397d43b03e358f7a9004590 Mon Sep 17 00:00:00 2001 From: cel Date: Fri, 10 Mar 2017 10:14:41 -0500 Subject: Publish message before rendering page and show it at the top of the page --- lib/render.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'lib/render.js') diff --git a/lib/render.js b/lib/render.js index ed8cb1a..eaca499 100644 --- a/lib/render.js +++ b/lib/render.js @@ -197,24 +197,17 @@ Render.prototype.privateLine = function (recps, cb) { return el } -Render.prototype.publish = function (content, cb) { +Render.prototype.msgLink = function (msg, cb) { var self = this - var el = h('div') - self.app.publish(content, function (err, msg) { + self.app.unboxMsg(msg, function (err, msg) { if (err) return el.appendChild(u.renderError(err)), cb() - self.app.unboxMsg(msg, function (err, msg) { - if (err) return el.appendChild(u.renderError(err)), cb() - self.renderMsg(msg, false, function (err, msgEl) { - if (err) msgEl = [ - h('a', {href: self.toUrl(msg.key)}, msg.key), - u.renderError(err)] - el.appendChild(h('div', - 'published:', - h('table.ssb-msgs', msgEl) - )) - cb() - }) + self.renderMsg(msg, false, function (err, msgEl) { + if (err) msgEl = [ + h('a', {href: self.toUrl(msg.key)}, msg.key), + u.renderError(err)] + el.appendChild(h('table.ssb-msgs', msgEl)) + cb() }) }) return el -- cgit v1.2.3