ssbc / ssb-friends

Manages the SSB social graph
MIT License
23 stars 6 forks source link

don't change following/blocking value unless the key is actually specified #9

Closed mmckegg closed 6 years ago

mmckegg commented 6 years ago

✅ Backwards compatible change (unless there is some client that is depending on this bug for unfollowing 😢 although unfollowing is rare, so even if so, wouldn't cause any great grief)


Currently, if a contact message without a following key is added, ssb-friends will treat this as unfollowing.

This behaviour is not consistent with the way that other key -> value types in ssb work. For example, creating an empty about message will not remove someone's name/image. Or creating a message with just an image won't remove their name.

This should also be the case with contact messages. We should require an explicit following: false in order to unfollow someone.

contact should be able to express relationships (such as sameAs or owner) and it can't do this in a nice way right now unless you hack on a following: lastValue to every message. This causes problems in clients because they see following: true and assume that that means this should be rendered as a following message though that value has not changed. IMO the value should ONLY be specified if that value has changed.

Let's nip this in the bud while ssb is still young and there aren't that many clients in the wild!

fixes https://github.com/ssbc/ssb-friends/issues/8

@dominictarr @clehner @mixmix @ahdinosaur @evbogue

mmckegg commented 6 years ago

Posted on ssb-ws by mistake

@dominictarr says:

looking at the code, there are only 3 states, following, unfolowing, and blocking. including blocking: true means you are blocking, but following: true has precidence if set.

So, I think we can merge this.

one small thing I did see one message that had following: 'true' %yERICTnx/L5Qga/xyU0n0wxZom3jYvJ/yDA1gyuVli4=.sha256 (I only looked at blocking messages, though)

And also some messages that are blocking: false %20x9Ou4zl2hSoMfvFQZexl/fpbeSjBtyztoiijgdUJo=.sha256 hmm, these would currently be interpreted as unfollow.

And there are a number of messages which are following: 'true'

maybe the check should be: 'undefined' !== typeof content.following && !! content.following ? means it needs an explicit follow, but "true" is still supported

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.