Commit 554227b56bc038b7b417b65385e48ab32fd189cf
don't search for votes if there is no message key
Ev Bogue committed on 5/1/2018, 2:37:27 AMParent: 12a75517dfb361b5f8a4df0c91372c0c68f1f164
Files changed
tools.js | changed |
tools.js | ||
---|---|---|
@@ -10,19 +10,20 @@ | ||
10 | 10 … | var config = require('./config')() |
11 | 11 … | |
12 | 12 … | function votes (msg) { |
13 | 13 … | var votes = h('div.votes') |
14 | - | |
15 | - pull( | |
16 | - sbot.backlinks({query: [{$filter: {dest: msg.key, value: { content: { type: 'vote' }}}}], live: true}), | |
17 | - pull.drain(function (data) { | |
18 | - console.log(data) | |
19 | - if (data.value) { | |
20 | - votes.appendChild(h('a', {href:'#' + data.key}, h('img.emoji', {src: config.emojiUrl + 'star.png'}))) | |
14 … | + if (msg.key) { | |
15 … | + pull( | |
16 … | + sbot.backlinks({query: [{$filter: {dest: msg.key, value: { content: { type: 'vote' }}}}], live: true}), | |
17 … | + pull.drain(function (data) { | |
21 | 18 … | console.log(data) |
22 | - } else {console.log(data)} | |
23 | - }) | |
24 | - ) | |
19 … | + if (data.value) { | |
20 … | + votes.appendChild(h('a', {href:'#' + data.key}, h('img.emoji', {src: config.emojiUrl + 'star.png'}))) | |
21 … | + console.log(data) | |
22 … | + } else {console.log(data)} | |
23 … | + }) | |
24 … | + ) | |
25 … | + } | |
25 | 26 … | return votes |
26 | 27 … | } |
27 | 28 … | |
28 | 29 … | module.exports.header = function (msg) { |
Built with git-ssb-web