Commit fec81386227bdfae59b98184c5a371cadbea9623
only show names and avatars assigned by people I follow or they follow
fixes #644Matt McKegg committed on 10/14/2017, 2:51:08 AM
Parent: faee06d1f732247ca8640e9962e972ce73bfcee6
Files changed
modules/page/html/render/profile.js | changed |
modules/page/html/render/profile.js | ||
---|---|---|
@@ -73,14 +73,14 @@ | ||
73 | 73 | return youFollow.includes(id) |
74 | 74 | }) |
75 | 75 | |
76 | 76 | var blockers = api.contact.obs.blockers(id) |
77 | - var youBlock = computed(blockers, function(blockers) { | |
77 | + var youBlock = computed(blockers, function (blockers) { | |
78 | 78 | return blockers.includes(yourId) |
79 | 79 | }) |
80 | 80 | |
81 | - var names = api.about.obs.names(id) | |
82 | - var images = api.about.obs.images(id) | |
81 | + var names = computed([api.about.obs.names(id), yourFollows, rawFollowing], onlyEndorsed) | |
82 | + var images = computed([api.about.obs.images(id), yourFollows, rawFollowing], onlyEndorsed) | |
83 | 83 | |
84 | 84 | var namePicker = h('div', {className: 'Picker'}, [ |
85 | 85 | map(dictToCollection(names), (item) => { |
86 | 86 | var isSelf = computed(item.value, (ids) => ids.includes(id)) |
@@ -219,8 +219,22 @@ | ||
219 | 219 | |
220 | 220 | container.pendingUpdates = feedView.pendingUpdates |
221 | 221 | container.reload = feedView.reload |
222 | 222 | return container |
223 | + | |
224 | + // scoped | |
225 | + | |
226 | + function onlyEndorsed (values, yourFollows, theirFollows) { | |
227 | + return Object.keys(values).reduce((result, key) => { | |
228 | + var ids = values[key].filter(id => { | |
229 | + return yourFollows.includes(id) || theirFollows.includes(id) | |
230 | + }) | |
231 | + if (ids.length) { | |
232 | + result[key] = ids | |
233 | + } | |
234 | + return result | |
235 | + }, {}) | |
236 | + } | |
223 | 237 | }) |
224 | 238 | |
225 | 239 | function renderContactBlock (title, profiles, yourFollows) { |
226 | 240 | profiles = api.profile.obs.rank(profiles) |
Built with git-ssb-web