From 31301646eb23b3edcc23cb3cb8980ed451b0c108 Mon Sep 17 00:00:00 2001 From: cel Date: Thu, 9 Aug 2018 15:03:07 -0700 Subject: Render chess invite/accept messages more compactly --- lib/render-msg.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/render-msg.js b/lib/render-msg.js index 2bc382e..f351039 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -1322,7 +1322,7 @@ RenderMsg.prototype.chessInvite = function (cb) { var myColor = self.c.myColor self.link(self.c.inviting, function (err, link) { if (err) return cb(err) - self.wrap([ + self.wrapMini([ 'invites ', link, ' to play chess', // myColor ? h('p', 'my color is ' + myColor) : '' ], cb) @@ -1344,12 +1344,16 @@ RenderMsg.prototype.chessInviteTitle = function (cb) { RenderMsg.prototype.chessInviteAccept = function (cb) { var self = this - self.link(self.c.root, function (err, rootLink) { + self.getMsg(self.c.root, function (err, rootMsg) { if (err) return cb(err) - self.wrap([ - h('div', h('small', '> ', rootLink)), - h('p', 'accepts invitation to play chess') - ], cb) + self.link(rootMsg.value.author, function (err, rootAuthorLink) { + if (err) return cb(err) + self.wrapMini([ + 'accepts ', + h('a', {href: self.toUrl(rootMsg.key)}, 'invitation to play chess'), ' ', + 'with ', rootAuthorLink + ], cb) + }) }) } -- cgit v1.2.3