Permalink
Browse files

make channels/hashtags case insensitive (uses ssb-ref normalizeChannel)

  • Loading branch information...
mmckegg committed Nov 20, 2017
1 parent ab49d98 commit 217c274425bfc6f97a221190b58a329730ab0482
View

This file was deleted.

Oops, something went wrong.
@@ -4,6 +4,7 @@ var nest = require('depnest')
exports.needs = nest({
'channel.obs.subscribed': 'first',
'message.html.compose': 'first',
'channel.sync.normalize': 'first',
'feed.html.rollup': 'first',
'feed.pull.channel': 'first',
'sbot.pull.log': 'first',
@@ -19,7 +20,7 @@ exports.create = function (api) {
return nest('page.html.render', function channel (path) {
if (path[0] !== '#') return
var channel = path.substr(1)
var channel = api.channel.sync.normalize(path.substr(1))
var subscribedChannels = api.channel.obs.subscribed(api.keys.sync.id())
var prepend = [
@@ -54,10 +55,10 @@ exports.create = function (api) {
function mentionFilter (msg) {
// filter out likes
if (msg.value.content.type === 'vote') return false
if (msg.value.content.channel === channel) return true
if (api.channel.sync.normalize(msg.value.content.channel) === channel) return true
if (Array.isArray(msg.value.content.mentions)) {
if (msg.value.content.mentions.some(mention => {
return mention && mention.link === `#${channel}`
return mention && api.channel.sync.normalize(mention.link) === `#${channel}`
})) {
return 'channel-mention'
}
@@ -1,7 +1,6 @@
var nest = require('depnest')
var extend = require('xtend')
var pull = require('pull-stream')
var normalizeChannel = require('../../../../lib/normalize-channel')
var { h, send, when, computed, map } = require('mutant')
exports.needs = nest({
@@ -30,6 +29,7 @@ exports.needs = nest({
subscribed: 'first',
recent: 'first'
},
'channel.sync.normalize': 'first',
'keys.sync.id': 'first',
'settings.obs.get': 'first',
'intl.sync.i18n': 'first'
@@ -89,7 +89,7 @@ exports.create = function (api) {
if (type === 'vote') return false
var author = msg.value.author
var channel = normalizeChannel(msg.value.content.channel)
var channel = api.channel.sync.normalize(msg.value.content.channel)
var tagged = checkTag(msg.value.content.mentions)
var isSubscribed = channel ? subscribedChannels().has(channel) : false
return isSubscribed || id === author || following().includes(author) || tagged
@@ -139,7 +139,7 @@ exports.create = function (api) {
if (Array.isArray(mentions)) {
return mentions.some((mention) => {
if (mention && typeof mention.link === 'string' && mention.link.startsWith('#')) {
var channel = normalizeChannel(mention.link.slice(1))
var channel = api.channel.sync.normalize(mention.link.slice(1))
return channel ? subscribedChannels().has(channel) : false
}
})
View
@@ -42,7 +42,7 @@
"mutant-pull-reduce": "^1.1.0",
"obv": "0.0.1",
"patch-settings": "^1.0.1",
"patchcore": "~1.16.0",
"patchcore": "~1.17.0",
"pull-abortable": "^4.1.0",
"pull-defer": "^0.2.2",
"pull-file": "~1.0.0",
@@ -58,15 +58,15 @@
"spacetime": "^1.0.7",
"ssb-about": "~0.1.1",
"ssb-avatar": "^0.2.0",
"ssb-backlinks": "~0.4.1",
"ssb-backlinks": "~0.5.0",
"ssb-blobs": "~1.1.4",
"ssb-friends": "^2.3.5",
"ssb-keys": "^7.0.13",
"ssb-mentions": "^0.4.0",
"ssb-msgs": "^5.2.0",
"ssb-private": "0.1.4",
"ssb-query": "^1.0.0",
"ssb-ref": "~2.7.1",
"ssb-ref": "^2.8.0",
"ssb-sort": "^1.0.0",
"statistics": "^3.3.0",
"suggest-box": "^2.2.3",
View
@@ -1,5 +1,5 @@
var FlumeReduce = require('flumeview-reduce')
var normalizeChannel = require('../lib/normalize-channel')
var normalizeChannel = require('ssb-ref').normalizeChannel
module.exports = function (ssb, config) {
return ssb._flumeUse('patchwork-channels', FlumeReduce(1, reduce, map))
View
@@ -4,7 +4,7 @@ var FlumeViewLevel = require('flumeview-level')
var pullCat = require('pull-cat')
var HLRU = require('hashlru')
var extend = require('xtend')
var normalizeChannel = require('../lib/normalize-channel')
var normalizeChannel = require('ssb-ref').normalizeChannel
var Defer = require('pull-defer')
// HACK: pull it out of patchcore
View
@@ -1,5 +1,5 @@
var FlumeReduce = require('flumeview-reduce')
var normalizeChannel = require('../lib/normalize-channel')
var normalizeChannel = require('ssb-ref').normalizeChannel
module.exports = function (ssb, config) {
return ssb._flumeUse('patchwork-subscriptions', FlumeReduce(3, reduce, map))

0 comments on commit 217c274

Please sign in to comment.