git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit fec81386227bdfae59b98184c5a371cadbea9623

only show names and avatars assigned by people I follow or they follow

fixes #644
Matt McKegg committed on 10/14/2017, 2:51:08 AM
Parent: faee06d1f732247ca8640e9962e972ce73bfcee6

Files changed

modules/page/html/render/profile.jschanged
modules/page/html/render/profile.jsView
@@ -73,14 +73,14 @@
7373 return youFollow.includes(id)
7474 })
7575
7676 var blockers = api.contact.obs.blockers(id)
77- var youBlock = computed(blockers, function(blockers) {
77+ var youBlock = computed(blockers, function (blockers) {
7878 return blockers.includes(yourId)
7979 })
8080
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)
8383
8484 var namePicker = h('div', {className: 'Picker'}, [
8585 map(dictToCollection(names), (item) => {
8686 var isSelf = computed(item.value, (ids) => ids.includes(id))
@@ -219,8 +219,22 @@
219219
220220 container.pendingUpdates = feedView.pendingUpdates
221221 container.reload = feedView.reload
222222 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+ }
223237 })
224238
225239 function renderContactBlock (title, profiles, yourFollows) {
226240 profiles = api.profile.obs.rank(profiles)

Built with git-ssb-web