Commit 8bf58f99dd17bfab291aed906bb0597c6f7f6920
improve invite experience -- auto-forward if already following and make screen friendlier
Ev Bogue committed on 12/26/2016, 12:40:11 AMParent: a5445e6bcd23a22f2da4671b84e81eedc42d81a6
Files changed
modules_basic/invite.js | changed |
modules_basic/invite.js | |||
---|---|---|---|
@@ -34,9 +34,9 @@ | |||
34 | 34 … | invite_accept: function (invite, onProgress, cb) { | |
35 | 35 … | var data = self.invite_parse(invite) | |
36 | 36 … | if(!data) return cb(new Error('not a valid invite code:' + invite)) | |
37 | 37 … | ||
38 | - onProgress('connecting...') | ||
38 … | + onProgress('Connecting...') | ||
39 | 39 … | ||
40 | 40 … | api.sbot_gossip_connect(data.remote, function (err) { | |
41 | 41 … | if(err) console.log(err) | |
42 | 42 … | }) | |
@@ -45,21 +45,21 @@ | |||
45 | 45 … | remote: data.invite, | |
46 | 46 … | manifest: { invite: {use: 'async'}, getAddress: 'async' } | |
47 | 47 … | }, function (err, sbot) { | |
48 | 48 … | if(err) return cb(err) | |
49 | - onProgress('requesting follow...') | ||
49 … | + onProgress('Requesting follow...') | ||
50 | 50 … | console.log(sbot) | |
51 | 51 … | sbot.invite.use({feed: id}, function (err, msg) { | |
52 | 52 … | ||
53 | 53 … | //if they already follow us, just check we actually follow them. | |
54 | 54 … | if(err) api.follower_of(id, data.key, function (_err, follows) { | |
55 | - if(follows) cb(err) | ||
55 … | + if(follows) { location.hash = '' } | ||
56 | 56 … | else next() | |
57 | 57 … | }) | |
58 | 58 … | else next() | |
59 | 59 … | ||
60 | 60 … | function next () { | |
61 | - onProgress('following...') | ||
61 … | + onProgress('Following...') | ||
62 | 62 … | ||
63 | 63 … | //remove the seed from the shs address. | |
64 | 64 … | //then it's correct address. | |
65 | 65 … | //this should make the browser connect to this as remote. | |
@@ -87,15 +87,17 @@ | |||
87 | 87 … | //connect to server | |
88 | 88 … | //request follow | |
89 | 89 … | //post pub announce | |
90 | 90 … | //post follow pub | |
91 | - var div = h('div.column', | ||
92 | - h('div', | ||
93 | - "you have been invited to join:", h('br'), | ||
94 | - h('code', data.invite) | ||
91 … | + var div = h('div.column.scroller__wrapper', | ||
92 … | + h('div.column.scroller__content', {style: 'margin-top: 25%;'}, | ||
93 … | + h('h1', {innerHTML: 'The <a href="https://scuttlebot.io">Secure Scuttlebutt</a> Lite Client'}), | ||
94 … | + h('p', "You've been invited to join:"), | ||
95 … | + h('p', h('code', data.invite)) | ||
95 | 96 … | ), | |
96 | - h('button', 'accept', {onclick: attempt}), | ||
97 | - progress | ||
97 … | + h('p', h('button', 'Accept', {onclick: attempt})), | ||
98 … | + progress, | ||
99 … | + h('p', "Once you're in, give yourself a name and photo. And don't forget to say 'Hello!'") | ||
98 | 100 … | ) | |
99 | 101 … | ||
100 | 102 … | function attempt () { | |
101 | 103 … | self.invite_accept(invite, function (message) { |
Built with git-ssb-web