git ssb

7+

dinoworm ๐Ÿ› / patchcore



Commit 07b744af8d044a6cc9f20deae76832329371760f

tidy up unused obs.following code

mix irving committed on 9/14/2017, 9:21:38 PM
Parent: 5d2368fbb63ed026f1ec95ac3ccf520f21aab635

Files changed

contact/obs.jschanged
contact/obs.jsView
@@ -20,10 +20,10 @@
2020 return nest({
2121 'contact.obs': {
2222 following: following,
2323 followers: followers,
24- blocking: (id) => values(get(id), 'blocking', true),
25- blockers: (id) => values(get(id), 'blockers', true),
24+ // blocking: (id) => values(get(id), 'blocking', true),
25+ // blockers: (id) => values(get(id), 'blockers', true),
2626 },
2727 'sbot.hook.publish': function (msg) {
2828 // TODO ???
2929 // if (isContact(msg)) {
@@ -79,26 +79,13 @@
7979 if (cache[next][key]) return [...sofar, next]
8080 else return sofar
8181 }, [])
8282 })
83- // var obs = computed(cache.keys, keys => {
84- // return keys
85- // .reduce((sofar, next) => {
86- // if (get(next)()[key]) return [...sofar, next]
87- // else return sofar
88- // }, [])
89- // })
9083
9184 obs.sync = sync
9285 return obs
9386 }
9487
95- function values (state, key, compare) {
96- var obs = computed([state, key, compare], getIds)
97- obs.sync = sync
98- return obs
99- }
100-
10188 function loadCache () {
10289 pull(
10390 api.sbot.pull.stream(sbot => sbot.friends.stream({live: true})),
10491 pull.drain(item => {
@@ -113,9 +100,8 @@
113100 )
114101 }
115102
116103 function update (sourceId, values) {
117- // ssb-contacts: values = { following, followers, blocking, blockers, ... }
118104 // ssb-friends: values = {
119105 // keyA: true|null|false (friend, neutral, block)
120106 // keyB: true|null|false (friend, neutral, block)
121107 // }
@@ -127,19 +113,9 @@
127113 lastState[targetId] = values[targetId]
128114 changed = true
129115 }
130116 }
131- // for (var key in values) {
132117
133- // var valuesForKey = lastState[key] = lastState[key] || {}
134- // for (var dest in values[key]) {
135- // var value = values[key][dest]
136- // if (!valuesForKey[dest] || value[1] > valuesForKey[dest][1] || !values[1] || !valuesForKey[dest[1]]) {
137- // valuesForKey[dest] = value
138- // changed = true
139- // }
140- // }
141- // }
142118 if (changed) {
143119 state.set(lastState)
144120 }
145121 }
@@ -156,19 +132,8 @@
156132 return cache.get(id)
157133 }
158134 }
159135
160-function getIds (state, key, compare) {
161- var result = new Set()
162- if (state[key]) {
163- for (var dest in state[key]) {
164- if (state[key][dest][0] === compare) {
165- result.add(dest)
166- }
167- }
168- }
169- return result
170-}
171-
172136 function isContact (msg) {
173137 return msg.value && msg.value.content && msg.value.content.type === 'contact'
174138 }
139+

Built with git-ssb-web