From 069af0cdf671deed1e378cb735985ac302a5c568 Mon Sep 17 00:00:00 2001 From: cel Date: Sun, 22 Oct 2017 13:05:44 -1000 Subject: Render chess_chat messages --- lib/render-msg.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/render-msg.js') diff --git a/lib/render-msg.js b/lib/render-msg.js index c5d4756..b4ce016 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -253,6 +253,8 @@ RenderMsg.prototype.message = function (cb) { case 'chess_game_end': case 'ssb_chess_game_end': return this.chessGameEnd(cb) + case 'chess_chat': + return this.chessChat(cb) case 'wifi-network': return this.wifiNetwork(cb) case 'mutual/credit': return this.mutualCredit(cb) case 'mutual/account': return this.mutualAccount(cb) @@ -377,6 +379,8 @@ RenderMsg.prototype.title1 = function (cb) { cb(null, self.c.record && JSON.stringify(self.c.record.data) || self.msg.key) else if (self.c.type === 'npm-publish') self.npmPublishTitle(cb) + else if (self.c.type === 'chess_chat') + cb(null, title(self.c.msg)) else self.app.getAbout(self.msg.key, function (err, about) { if (err) return cb(err) @@ -1175,6 +1179,17 @@ RenderMsg.prototype.chessGameEnd = function (cb) { }) } +RenderMsg.prototype.chessChat = function (cb) { + var self = this + self.link(self.c.root, function (err, rootLink) { + if (err) return cb(err) + self.wrap([ + h('div', h('small', '> ', rootLink)), + h('p', self.c.msg) + ], cb) + }) +} + RenderMsg.prototype.chessMove = function (cb) { if (this.opts.full) return this.chessMoveFull(cb) return this.chessMoveMini(cb) -- cgit v1.2.3