Files: 2a3b514162af82f82e2d8b229bcf5db9c72bbc96 / modules / suggest-mentions.js
753 bytesRaw
1 | var pull = require('pull-stream') |
2 | var cont = require('cont') |
3 | function isImage (filename) { |
4 | return /\.(gif|jpg|png|svg)$/i.test(filename) |
5 | } |
6 | |
7 | var sbot_links2 = require('../plugs').first(exports.sbot_links2 = []) |
8 | var blob_url = require('../plugs').first(exports.blob_url = []) |
9 | var signified = require('../plugs').first(exports.signified = []) |
10 | |
11 | exports.suggest = cont.to(function (word, cb) { |
12 | if(!/^@\w/.test(word)) return cb() |
13 | |
14 | |
15 | signified(word, function (err, names) { |
16 | if(err) cb(err) |
17 | else cb(null, names.map(function (e) { |
18 | return { |
19 | title: e.name + ': ' + e.id.substring(0,10)+' ('+e.rank+')', |
20 | value: '['+e.name+']('+e.id+')', |
21 | rank: e.rank, |
22 | //TODO: avatar images... |
23 | } |
24 | })) |
25 | }) |
26 | }) |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 |
Built with git-ssb-web