git ssb

7+

dinoworm 🐛 / patchcore



Commit 4847a139bc534508558e7f8744c286642ea33a5d

normalize subscribed list, expose normalizeChannel from ssb-ref

Matt McKegg committed on 11/20/2017, 3:22:24 AM
Parent: c2515fc07d5df937b0ab574f42b22ed788831215

Files changed

channel/obs/subscribed.jschanged
channel/sync/normalize.jsadded
feed/pull/channel.jschanged
package.jsonchanged
channel/obs/subscribed.jsView
@@ -6,9 +6,10 @@
66
77 var throttle = require('mutant/throttle')
88
99 exports.needs = nest({
10- 'sbot.pull.userFeed': 'first'
10 + 'sbot.pull.userFeed': 'first',
11 + 'channel.sync.normalize': 'first'
1112 })
1213
1314 exports.gives = nest({
1415 'channel.obs.subscribed': true,
@@ -46,9 +47,9 @@
4647
4748 var result = MutantPullReduce(stream, (result, msg) => {
4849 var c = msg.value.content
4950 if (c.type === 'channel' && typeof c.channel === 'string') {
50- var channel = c.channel.trim()
51 + var channel = api.channel.sync.normalize(c.channel)
5152 if (channel && msg.value.timestamp > (latestTimestamps[channel] || 0)) {
5253 if (channel) {
5354 if (typeof c.subscribed === 'boolean') {
5455 latestTimestamps[channel] = msg.value.timestamp
channel/sync/normalize.jsView
@@ -1,0 +1,8 @@
1 +var nest = require('depnest')
2 +var normalizeChannel = require('ssb-ref').normalizeChannel
3 +
4 +exports.gives = nest('channel.sync.normalize')
5 +
6 +exports.create = function (api) {
7 + return nest('channel.sync.normalize', normalizeChannel)
8 +}
feed/pull/channel.jsView
@@ -4,13 +4,15 @@
44
55 exports.gives = nest('feed.pull.channel')
66 exports.needs = nest({
77 'sbot.pull.backlinks': 'first',
8 + 'channel.sync.normalize': 'first',
89 'message.sync.isBlocked': 'first'
910 })
1011
1112 exports.create = function (api) {
1213 return nest('feed.pull.channel', function (channel) {
14 + channel = api.channel.sync.normalize(channel)
1315 if (typeof channel !== 'string') throw new Error('a channel name be specified')
1416
1517 return function (opts) {
1618 // handle last item passed in as lt
package.jsonView
@@ -55,9 +55,9 @@
5555 "ssb-friends": "^2.2.3",
5656 "ssb-keys": "^7.0.9",
5757 "ssb-markdown": "^3.3.0",
5858 "ssb-marked": "^0.7.2",
59- "ssb-ref": "^2.6.2",
59 + "ssb-ref": "^2.8.0",
6060 "ssb-sort": "^1.0.0",
6161 "xtend": "^4.0.1"
6262 },
6363 "browserify": {

Built with git-ssb-web