aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/render.js6
-rw-r--r--lib/serve.js11
2 files changed, 10 insertions, 7 deletions
diff --git a/lib/render.js b/lib/render.js
index ec62b31..e246923 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -355,11 +355,11 @@ Render.prototype.privateLine = function (recps, isAuthorRecp, cb) {
return el
}
-Render.prototype.msgLink = function (msg, cb) {
+Render.prototype.msgIdLink = function (id, cb) {
var self = this
var el = h('span')
- var a = h('a', {href: self.toUrl(msg.key)}, msg.key)
- self.app.unboxMsg(msg, function (err, msg) {
+ var a = h('a', {href: self.toUrl(id)}, id)
+ self.app.getMsgDecrypted(id, function (err, msg) {
if (err) return el.appendChild(u.renderError(err)), cb()
var renderMsg = new RenderMsg(self, self.app, msg, {wrap: false})
renderMsg.title(function (err, title) {
diff --git a/lib/serve.js b/lib/serve.js
index d0a9624..34861bc 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -26,6 +26,7 @@ var Diff = require('diff')
var split = require('pull-split')
var utf8 = require('pull-utf8-decoder')
var webresolve = require('ssb-web-resolver')
+var Url = require('url')
module.exports = Serve
@@ -181,8 +182,10 @@ Serve.prototype.go = function () {
if (self.data.redirect_to_published_msg) {
self.redirect(self.app.render.toUrl(publishedMsg.key))
} else {
- self.publishedMsg = publishedMsg
- self.handle()
+ var u = Url.parse(self.req.url)
+ var q = u.query || (u.query = {})
+ q.published = publishedMsg.key
+ self.redirect(Url.format(u))
}
} else {
self.handle()
@@ -1800,9 +1803,9 @@ Serve.prototype.wrapPage = function (title, searchQ) {
]
})
)),
- self.publishedMsg ? h('div',
+ self.query.published ? h('div',
'published ',
- self.app.render.msgLink(self.publishedMsg, done())
+ render.msgIdLink(self.query.published, done())
) : '',
// self.note,
content