git ssb

16+

Dominic / patchbay



Commit 0f5ed1e921e14b6d02745c152fcdaeb2701aac89

oops, signifier, not signifiers

Dominic Tarr committed on 8/1/2016, 1:31:29 AM
Parent: 8418f87e82733cfd50038aed3b810e26957287fe

Files changed

modules/avatar-name.jschanged
modules/names.jschanged
modules/avatar-name.jsView
@@ -1,6 +1,7 @@
11
2-var signifers = require('../plugs').first(exports.signifers = [])
2+var signifier = require('../plugs').first(exports.signifier = [])
3+var h = require('hyperscript')
34
45 exports.avatar_name =
56 function name (id) {
67 var n = h('span', id.substring(0, 10))
@@ -11,9 +12,9 @@
1112 //is pretty powerful!
1213 //TODO: "most popular" name is easily gameable.
1314 //must come up with something better than this.
1415
15- exports.signifiers(id, function (_, names) {
16+ signifier(id, function (_, names) {
1617 if(names.length) n.textContent = names[0].name
1718 })
1819
1920 return n
modules/names.jsView
@@ -1,15 +1,12 @@
1-var h = require('hyperscript')
21 var pull = require('pull-stream')
32
43 function all(stream, cb) {
54 pull(stream, pull.collect(cb))
65 }
76
87 var plugs = require('../plugs')
9-var getAvatar = require('ssb-avatar')
108 var sbot_links2 = plugs.first(exports.sbot_links2 = [])
11-var sbot_links = plugs.first(exports.sbot_links = [])
129
1310 /*
1411 filter(rel: ['mentions', prefix('@')]) | reduce(name: rel[1], value: count())
1512 */
@@ -78,14 +75,13 @@
7875 function rank(ary) {
7976 return ary.sort(function (a, b) { return b.rank - a.rank })
8077 }
8178
82-exports.signifiers = async(function (id) {
79+exports.signifier = async(function (id) {
8380 return rank(names.filter(function (e) { return e.id == id}))
8481 })
8582
8683 exports.signified = async(function (name) {
8784 var rx = new RegExp('^'+name)
8885 return rank(names.filter(function (e) { return rx.test(e.name) }))
8986 })
9087
91-

Built with git-ssb-web