git ssb

0+

Matt McKegg / ssb-backlinks



Commit f8f6dea260ff781d496a17158ef9fd91603b8ea5

use `ref.normalizeChannel` for indexing to make case insensitive

Matt McKegg committed on 11/20/2017, 3:27:51 AM
Parent: 5a54f8ce3a5ceb141438521584923130a229f879

Files changed

emit-links.jschanged
index.jschanged
package.jsonchanged
emit-links.jsView
@@ -9,14 +9,16 @@
99 var links = new Set()
1010 walk(msg.value.content, function (path, value) {
1111 // HACK: handle legacy channel mentions
1212 if (deepEqual(path, ['channel']) && typeof value === 'string' && value.length < 30) {
13- value = `#${value.replace(/\s/g, '')}`
13 + value = `#${ref.normalizeChannel(value)}`
1414 }
1515
1616 // TODO: should add channel matching to ref.type
17- if (ref.type(value) || isChannel(value)) {
17 + if (ref.type(value)) {
1818 links.add(value)
19 + } else if (isChannel(value)) {
20 + links.add(ref.normalizeChannel(value))
1921 }
2022 })
2123 links.forEach(link => {
2224 emit(extend(msg, {
index.jsView
@@ -8,9 +8,9 @@
88 { key: 'DTA', value: [['dest'], ['value', 'timestamp']] }, // asserted timestamp
99 { key: 'TDT', value: [['value', 'content', 'type'], ['dest'], ['value', 'timestamp']] }
1010 ]
1111
12-var indexVersion = 3
12 +var indexVersion = 5
1313
1414 exports.name = 'backlinks'
1515 exports.version = require('./package.json').version
1616 exports.manifest = {
package.jsonView
@@ -15,9 +15,9 @@
1515 "map-filter-reduce": "^3.0.3",
1616 "pull-flatmap": "0.0.1",
1717 "pull-stream": "^3.6.0",
1818 "ssb-keys": "^7.0.9",
19- "ssb-ref": "^2.7.1",
19 + "ssb-ref": "^2.8.0",
2020 "xtend": "^4.0.1"
2121 },
2222 "devDependencies": {},
2323 "scripts": {},

Built with git-ssb-web