git ssb

10+

Matt McKegg / patchwork



Commit df697b6ed4d32422df439d0d48d65a64d1d9b04a

swap channel subscription rollup around the other way (per channel)

Matt McKegg committed on 4/7/2017, 5:40:05 AM
Parent: bed484f1df0e3d56efaf7d40ae488bd6fd78cd87

Files changed

modules/feed/html/rollup.jschanged
modules/feed/pull/summary.jschanged
modules/feed/html/rollup.jsView
@@ -223,13 +223,13 @@
223223 ])
224224 } else if (item.type === 'subscribe') {
225225 return h('FeedEvent -subscribe', [
226226 h('div.meta', {
227- title: Array.from(item.channels).map(c => `#${c}`).join('\n')
227 + title: names(item.subscribers)
228228 }, [
229- api.profile.html.person(item.id), ' subscribed to ', many(item.channels, (channel) => {
230- return h('a', {href: `#${channel}`}, `#${channel}`)
231- })
229 + many(item.subscribers, api.profile.html.person),
230 + ' subscribed to ',
231 + h('a', {href: `#${item.channel}`}, `#${item.channel}`)
232232 ])
233233 ])
234234 }
235235
modules/feed/pull/summary.jsView
@@ -188,29 +188,28 @@
188188 }
189189
190190 function updateChannel (msg, groups) {
191191 var c = msg.value.content
192- var id = msg.value.author
193- var group = groups[id]
194- if (typeof c.channel === 'string') {
192 + var channel = c.channel
193 + var group = groups[channel]
194 + if (typeof channel === 'string') {
195195 if (c.subscribed) {
196196 if (!group) {
197- group = groups[id] = {
197 + group = groups[channel] = {
198198 type: 'subscribe',
199199 lastUpdateType: null,
200- channels: new Set(),
200 + subscribers: new Set(),
201201 updated: 0,
202- author: id,
203- id: id
202 + channel
204203 }
205204 }
206- group.channels.add(c.channel)
205 + group.subscribers.add(msg.value.author)
207206 group.updated = msg.timestamp || msg.value.sequence
208207 } else {
209208 if (group) {
210- group.channels.delete(c.channel)
211- if (!group.channels.size) {
212- delete groups[id]
209 + group.subscribers.delete(msg.value.author)
210 + if (!group.subscribers.size) {
211 + delete groups[channel]
213212 }
214213 }
215214 }
216215 }

Built with git-ssb-web