diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-01-28 19:14:13 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-01-28 19:36:02 -1000 |
commit | ba5b68142c6759e3e48ff2837c578a2deaa0ca8d (patch) | |
tree | c1806fad92214659f41650817074c43e765708a2 /lib | |
parent | b98ac1c05e9cc1bcb1f25e75147d256ae5d00761 (diff) | |
download | patchfoo-ba5b68142c6759e3e48ff2837c578a2deaa0ca8d.tar.gz patchfoo-ba5b68142c6759e3e48ff2837c578a2deaa0ca8d.zip |
Handle old-style auto-follow
Diffstat (limited to 'lib')
-rw-r--r-- | lib/render-msg.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 2af4bca..9e33be6 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -709,12 +709,23 @@ RenderMsg.prototype.aboutRating = function (cb) { RenderMsg.prototype.contact = function (cb) { var self = this + + // In message content, autofollow:true means following a pub in connection with using an invite code to it. pub:true means the author is a pub, responding to an invite code. But I think it makes more sense to switch the terms and call the follow from the pub auto-follow, since the pub does it automatically, and the follow from the one using an invite code pub-follow ("X follows pub Y") since it is to follow a pub. + // In scuttlebot before v8.4.0 (1ac0b9cf8214899baf0ba7ff4c0924d21a1b48cf), autofollow:true was used for both kinds of follows. We can detect that using the timestamp and/or the order of keys. + + var pubFollow = self.c.following && self.c.autofollow + var autoFollow = self.c.following && self.c.pub + if (pubFollow && self.msg.value.timestamp < 1469361582000 + && Object.keys(self.c).join() === 'type,contact,following,autofollow') { + pubFollow = false + autoFollow = true + } self.link(self.c.contact, function (err, a) { if (err) return cb(err) if (!a) a = "?" self.wrapMini([ - self.c.following && self.c.autofollow ? 'follows pub' : - self.c.following && self.c.pub ? 'autofollows' : + pubFollow ? 'follows pub' : + autoFollow ? 'autofollows' : self.c.following ? 'follows' : self.c.blocking ? 'blocks' : self.c.flagged ? 'flagged' : |