From 3b4e38cc4b02d5f47a531c3029520e67d98d6d10 Mon Sep 17 00:00:00 2001 From: cel Date: Mon, 28 Jan 2019 20:22:36 -1000 Subject: Add mute (private block) button --- lib/serve.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/serve.js') diff --git a/lib/serve.js b/lib/serve.js index 30b529b..7eefc9f 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -219,6 +219,9 @@ Serve.prototype.publishContact = function (next) { if (this.data.block) content.blocking = true if (this.data.unfollow) content.following = false if (this.data.unblock) content.blocking = false + if (this.data.mute) content.blocking = true + if (this.data.unmute) content.blocking = false + if (this.data.mute || this.data.unmute) content.recps = [this.app.sbot.id] if (this.app.previewContacts) { var json = JSON.stringify(content, 0, 2) var q = qs.stringify({text: json, action: 'preview'}) @@ -1757,7 +1760,8 @@ Serve.prototype.followInfo = function (id, myId) { var done = multicb({pluck: 1, spread: true}) self.app.getContact(myId, id, done()) self.app.getContact(id, myId, done()) - done(function (err, contactToThem, contactFromThem) { + self.app.isMuted(id, done()) + done(function (err, contactToThem, contactFromThem, isMuted) { if (err) return cb(err) cb(null, ph('form', {action: '', method: 'post'}, [ contactFromThem ? contactToThem ? 'friend ' : 'follows you ' : @@ -1769,7 +1773,11 @@ Serve.prototype.followInfo = function (id, myId) { value: contactToThem ? 'unfollow' : 'follow'}), ' ', ph('input', {type: 'submit', name: contactToThem === false ? 'unblock' : 'block', - value: contactToThem === false ? 'unblock' : 'block'}) + value: contactToThem === false ? 'unblock' : 'block'}), ' ', + ph('input', {type: 'submit', + name: isMuted ? 'unmute' : 'mute', + value: isMuted ? 'unmute' : 'mute', + title: isMuted ? 'unmute (private unblock)' : 'mute (private block)'}) ])) }) }) -- cgit v1.2.3