Commit 0fea233fca9208a686f53687dc39b14b3215c371
fix following since follow toggle button
Matt McKegg committed on 10/17/2017, 1:06:47 AMParent: f51b630f45cbadef6273df197f1bbeecd968edb0
Files changed
plugs/contact/html/follow-toggle.js | changed |
plugs/contact/html/follow-toggle.js | ||
---|---|---|
@@ -4,8 +4,10 @@ | ||
4 | 4 | exports.gives = nest('contact.html.followToggle') |
5 | 5 | exports.needs = nest({ |
6 | 6 | 'intl.sync.i18n': 'first', |
7 | 7 | 'keys.sync.id': 'first', |
8 | + 'contact.async.follow': 'first', | |
9 | + 'contact.async.unfollow': 'first', | |
8 | 10 | 'contact.async.block': 'first', |
9 | 11 | 'contact.async.unblock': 'first', |
10 | 12 | 'contact.obs.following': 'first', |
11 | 13 | 'contact.obs.followers': 'first', |
@@ -59,13 +61,13 @@ | ||
59 | 61 | when(youFollow, |
60 | 62 | h('a.ToggleButton.-unsubscribe', { |
61 | 63 | 'href': '#', |
62 | 64 | 'title': i18n('Click to unfollow'), |
63 | - 'ev-click': send(unfollow, id) | |
65 | + 'ev-click': send(api.contact.async.unfollow, id) | |
64 | 66 | }, when(isFriends, i18n('Friends'), i18n('Following'))), |
65 | 67 | h('a.ToggleButton.-subscribe', { |
66 | 68 | 'href': '#', |
67 | - 'ev-click': send(follow, id) | |
69 | + 'ev-click': send(api.contact.async.follow, id) | |
68 | 70 | }, when(followsYou, i18n('Follow Back'), i18n('Follow'))) |
69 | 71 | ), |
70 | 72 | when(showBlockButton, h('a.ToggleButton.-blocking', { |
71 | 73 | 'href': '#', |
@@ -76,21 +78,5 @@ | ||
76 | 78 | } else { |
77 | 79 | return [] |
78 | 80 | } |
79 | 81 | }) |
80 | - | |
81 | - function follow (id) { | |
82 | - api.sbot.async.publish({ | |
83 | - type: 'contact', | |
84 | - contact: id, | |
85 | - following: true | |
86 | - }) | |
87 | - } | |
88 | - | |
89 | - function unfollow (id) { | |
90 | - api.sbot.async.publish({ | |
91 | - type: 'contact', | |
92 | - contact: id, | |
93 | - following: false | |
94 | - }) | |
95 | - } | |
96 | 82 | } |
Built with git-ssb-web