diff options
Diffstat (limited to 'lib/serve.js')
-rw-r--r-- | lib/serve.js | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/lib/serve.js b/lib/serve.js index 11630e4..6d3786d 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -193,8 +193,11 @@ Serve.prototype.publishContact = function (cb) { var content = { type: 'contact', contact: this.data.contact, - following: !!this.data.following } + if (this.data.follow) content.following = true + if (this.data.block) content.blocking = true + if (this.data.unfollow) content.following = false + if (this.data.unblock) content.blocking = false this.publish(content, cb) } @@ -1499,20 +1502,6 @@ Serve.prototype.renderIdsList = function () { ) } -var relationships = [ - '', - 'followed', - 'follows you', - 'friend' -] - -var relationshipActions = [ - 'follow', - 'unfollow', - 'follow back', - 'unfriend' -] - Serve.prototype.wrapUserFeed = function (isScrolled, id) { var self = this var myId = self.app.sbot.id @@ -1520,11 +1509,10 @@ Serve.prototype.wrapUserFeed = function (isScrolled, id) { return u.hyperwrap(function (thread, cb) { var done = multicb({pluck: 1, spread: true}) self.app.getAbout(id, done()) - self.app.getFollow(myId, id, done()) - self.app.getFollow(id, myId, done()) - done(function (err, about, weFollowThem, theyFollowUs) { + self.app.getContact(myId, id, done()) + self.app.getContact(id, myId, done()) + done(function (err, about, contactToThem, contactFromThem) { if (err) return cb(err) - var relationshipI = weFollowThem | theyFollowUs<<1 var done = multicb({pluck: 1, spread: true}) done()(null, [ h('section.ssb-feed', @@ -1558,13 +1546,16 @@ Serve.prototype.wrapUserFeed = function (isScrolled, id) { id === myId ? '' : h('tr', h('td'), h('td.follow-info', h('form', {action: '', method: 'post'}, - relationships[relationshipI], ' ', + contactFromThem ? contactToThem ? 'friend ' : 'follows you ' : + contactFromThem === false ? 'blocks you ' : '', h('input', {type: 'hidden', name: 'action', value: 'contact'}), h('input', {type: 'hidden', name: 'contact', value: id}), - h('input', {type: 'hidden', name: 'following', - value: weFollowThem ? '' : 'following'}), h('input', {type: 'submit', - value: relationshipActions[relationshipI]}) + name: contactToThem ? 'unfollow' : 'follow', + value: contactToThem ? 'unfollow' : 'follow'}), ' ', + h('input', {type: 'submit', + name: contactToThem === false ? 'unblock' : 'block', + value: contactToThem === false ? 'unblock' : 'block'}) )) ) ] |