git ssb

16+

Dominic / patchbay



Tree: 307df129331fb2304b165db3702a5b8f05c84031

Files: 307df129331fb2304b165db3702a5b8f05c84031 / modules_basic / avatar / name.js

668 bytesRaw
1var h = require('hyperscript')
2
3exports.needs = {
4 signifier: 'first'
5}
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