git ssb

7+

dinoworm 🐛 / patchcore



Commit a4fe9e20496ae2e80bb64e4e6d707119424ef139

Merge pull request #29 from ssbc/autofollow

autofollow: allow building in a default pub
mix irving authored on 8/17/2017, 2:57:07 AM
GitHub committed on 8/17/2017, 2:57:07 AM
Parent: cfd8810edb72821b5273b552d776456b7a6d4ae0
Parent: 9469eaafc9482e2d17b32da95e903b8bf02737a4

Files changed

invite.jschanged
invite.jsView
@@ -10,12 +10,15 @@
1010 'contact.async.followerOf': 'first',
1111 'keys.sync.id': 'first'
1212 })
1313
14-exports.gives = nest('invite.async.accept')
14 +exports.gives = nest({
15 + 'invite.async.accept': true,
16 + 'invite.async.autofollow': true,
17 +})
1518
1619 exports.create = function (api) {
17- return nest('invite.async.accept', function (invite, cb) {
20 + function accept (invite, cb) {
1821 var progress = Value('Connecting...')
1922 var data = ref.parseInvite(invite)
2023 var id = api.keys.sync.id()
2124 if (!data) return cb(new Error('Not a valid invite code. Please make sure you copied the entire code and try again.'))
@@ -69,6 +72,19 @@
6972 })
7073 })
7174
7275 return progress
76 + }
77 + return nest({
78 + 'invite.async.accept': accept,
79 + //like invite, but check whether we already follow them first
80 + 'invite.async.autofollow': function (invite, cb) {
81 + var id = api.keys.sync.id()
82 + var data = ref.parseInvite(invite)
83 + api.contact.async.followerOf(id, data.key, function (_, follows) {
84 + if (follows) console.log('already following', cb())
85 + else accept(invite, cb)
86 + })
87 + }
7388 })
7489 }
90 +

Built with git-ssb-web