git ssb

0+

mixmix / ssb-server-channel



Commit 09033d728a841a682c6a03b0e6f6b4c8f9a5f726

strange issue with Set, converted to arrays (hackish)

andre alves garzia committed on 2/2/2018, 4:21:11 AM
Parent: ed7ce18d13ca61dec8480839bd240b0f4d50ee43

Files changed

index.jschanged
index.jsView
@@ -1,16 +1,17 @@
11 const FlumeView = require('flumeview-reduce')
22 const get = require('lodash/get')
33 const set = require('lodash/set')
44
5-const FLUME_VIEW_VERSION = 1.5
5 +const FLUME_VIEW_VERSION = 1.10
66
77 module.exports = {
88 name: 'channel',
99 version: require('./package.json').version,
1010 manifest: {
1111 get: 'async',
1212 stream: 'source',
13 + subscription: 'async'
1314 },
1415 init: (server, config) => {
1516 console.log('///// CHANNELS plugin loaded /////')
1617
@@ -54,17 +55,19 @@
5455 function reduce(soFar, newSub) {
5556 process.stdout.write('c')
5657 const { channel, author, subscribed } = newSub
5758
58- const channelSubs = get(soFar, [channel], new Set())
59 + let channelSubs = get(soFar, [channel], [])
5960
61 + channelSubs = new Set(channelSubs)
62 +
6063 if (subscribed) {
6164 channelSubs.add(author)
6265 } else {
6366 channelSubs.delete(author)
6467 }
6568
66- soFar[channel] = channelSubs
69 + soFar[channel] = [...channelSubs]
6770
6871 return soFar
6972 }
7073

Built with git-ssb-web