From b10544275bc5120992629a4a0a09c5a74dabd41c Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 9 Jan 2019 10:51:44 -1000 Subject: Render pub-owner-announce and pub-owner-confirm messages --- lib/render-msg.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'lib/render-msg.js') diff --git a/lib/render-msg.js b/lib/render-msg.js index 6501d7d..846700f 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -331,6 +331,8 @@ RenderMsg.prototype.message = function (cb) { case 'invite': return this.invite(cb) case 'ssb-igo': return this.igo(cb) case 'address': return this.address(cb) + case 'pub-owner-announce': return this.pubOwnerAnnounce(cb) + case 'pub-owner-confirm': return this.pubOwnerConfirm(cb) default: return this.object(cb) } } @@ -733,13 +735,35 @@ RenderMsg.prototype.address = function (cb) { this.wrapMini([ 'has address', !isNaN(availability) ? [ - ' with availability ', h('code', String(availability + '%')) + ' with availability ', + h('code', availability + '%') ] : '', ': ', h('input', {disabled: 'disabled', value: String(this.c.address), style: 'width:100%'}), ], cb) } +RenderMsg.prototype.pubOwnerAnnounce = function (cb) { + var self = this + self.link(self.c.pub, function (err, pubLink) { + if (err) return cb(err) + self.wrapMini(['announces ownership of pub ', pubLink], cb) + }) +} + +RenderMsg.prototype.pubOwnerConfirm = function (cb) { + var self = this + var announcement = this.c.announcement + this.wrap([ + 'confirms pub ownership announcement ', + h('a', {href: this.toUrl(announcement)}, truncate(announcement, 10)), + this.c.address ? [ + '. address: ', + h('input', {disabled: 'disabled', value: String(this.c.address), style: 'width:100%'}) + ] : '' + ], cb) +} + RenderMsg.prototype.channel = function (cb) { var chan = '#' + this.c.channel this.wrapMini([ -- cgit v1.2.3