git ssb

2+

ev / mvd



Commit ef33ab337c848fb05b567cdab92bd9a21bedfab5

not-quite-working invite onboarding

Ev Bogue committed on 6/16/2018, 3:02:16 AM
Parent: 1d4c84a26e992a18358cb0e3c675e1608c9f9ed7

Files changed

scuttlebot.jschanged
views.jschanged
scuttlebot.jsView
@@ -45,8 +45,11 @@
4545
4646 var feed = createFeed(internal, keys, {remote: true})
4747
4848 module.exports = {
49 + acceptInvite: rec.async(function (invite, cb) {
50 + sbot.invite.accept(invite, cb)
51 + }),
4952 createLogStream: rec.source(function (opts) {
5053 return pull(
5154 sbot.createLogStream(opts),
5255 pull.through(function (e) {
views.jsView
@@ -270,5 +270,31 @@
270270 keyPage()
271271 } else {
272272 everythingStream()
273273 }
274 +
275 + sbot.friends.get({dest: id}, function (err, follows) {
276 + var currentScreen = document.getElementById('screen')
277 + if (follows === null) {
278 + if (document.getElementById('inviter')) { return }
279 + var invitebox = h('input', {placeholder: 'Invite Code Here'})
280 + var invite = h('div.message#inviter',
281 + 'Hey, no one follows you. Either ', h('a', {href: '#key'}, 'import your key'), ' or get an invite from a pub:',
282 + h('br'),
283 + invitebox,
284 + h('button', 'Accept', {onclick: function (invite) {
285 + sbot.acceptInvite(invitebox.value, function (err, invited) {
286 + if (err) throw err
287 + console.log(invited)
288 + location.hash = '#' + id
289 + location.hash = '#'
290 + })
291 + }})
292 + )
293 + if (currentScreen.firstChild.firstChild) {
294 + currentScreen.firstChild.insertBefore(invite, currentScreen.firstChild.firstChild)
295 + } else {
296 + currentScreen.firstChild.appendChild(invite)
297 + }
298 + }
299 + })
274300 }

Built with git-ssb-web