git ssb

16+

Dominic / patchbay



Tree: 1462eddad93e346c412fe00dd5fb4468adf1ee04

Files: 1462eddad93e346c412fe00dd5fb4468adf1ee04 / 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