Show channel subscriptions

This commit is contained in:
Anders Rune Jensen
2017-04-17 08:58:42 +02:00
parent a606674d30
commit 5544d14b7f
+3 -7
View File
@@ -201,9 +201,6 @@ exports.init = function (sbot, config) {
(msg.value.author in following || (msg.value.author in following ||
msg.value.content.channel in channelSubscriptions) msg.value.content.channel in channelSubscriptions)
}), }),
pull.filter((msg) => { // channel subscription
return !msg.value.content.subscribed
}),
pull.collect(function (err, logs) { pull.collect(function (err, logs) {
if (err) return respond(res, 500, err.stack || err) if (err) return respond(res, 500, err.stack || err)
res.writeHead(200, { res.writeHead(200, {
@@ -244,9 +241,6 @@ exports.init = function (sbot, config) {
pull( pull(
sbot.query.read({ limit: 500, reverse: true, query: [{$filter: { value: { content: { channel: channelId }}}}]}), sbot.query.read({ limit: 500, reverse: true, query: [{$filter: { value: { content: { channel: channelId }}}}]}),
pull.filter((msg) => { // channel subscription
return !msg.value.content.subscribed
}),
pull.collect(function (err, logs) { pull.collect(function (err, logs) {
if (err) return respond(res, 500, err.stack || err) if (err) return respond(res, 500, err.stack || err)
res.writeHead(200, { res.writeHead(200, {
@@ -599,7 +593,7 @@ function render(opts, c)
var name = c.contact var name = c.contact
if (typeof c.contactAbout != 'undefined') if (typeof c.contactAbout != 'undefined')
name = c.contactAbout.name name = c.contactAbout.name
return ' followed <a href="/user/' + c.contact + '">' + name + "</a>" return ' followed <a href="/' + c.contact + '">' + name + "</a>"
} }
else if (typeof c == 'string') else if (typeof c == 'string')
return ' wrote something private ' return ' wrote something private '
@@ -613,6 +607,8 @@ function render(opts, c)
return ' updated dns' return ' updated dns'
else if (c.type == 'pub') else if (c.type == 'pub')
return ' connected to a pub' return ' connected to a pub'
else if (c.type == 'channel' && c.subscribed)
return ' subscribed to channel <a href="/channel/' + c.channel + '">#' + c.channel + "</a>"
else else
return renderDefault(c) return renderDefault(c)
} }