git ssb

16+

Dominic / patchbay



Tree: 7d510f40ceb47f6b4863bc121426ce7492a1bbbc

Files: 7d510f40ceb47f6b4863bc121426ce7492a1bbbc / modules_basic / avatar-name.js

733 bytesRaw
1
2var signifier = require('../plugs').first(exports.signifier = [])
3var h = require('hyperscript')
4
5exports.needs = { signifier: 'first' }
6
7exports.gives = 'avatar_name'
8
9exports.create = function (api) {
10
11 return function name (id) {
12 var n = h('span', id ? id.substring(0, 10) : "")
13
14 //choose the most popular name for this person.
15 //for anything like this you'll see I have used sbot.links2
16 //which is the ssb-links plugin. as you'll see the query interface
17 //is pretty powerful!
18 //TODO: "most popular" name is easily gameable.
19 //must come up with something better than this.
20
21 api.signifier(id, function (_, names) {
22 if(names.length) n.textContent = names[0].name
23 })
24
25 return n
26 }
27
28}
29
30

Built with git-ssb-web