git ssb

0+

dangerousbeans / yap



forked from Dominic / yap

Commit c343d27955954f95f2c6ce3302289420b7e1e075

can type in @name and get to feed quickly

Dominic Tarr committed on 12/16/2018, 11:35:57 AM
Parent: 400e46051f560a0554711aaff869e200a5ea7a8a

Files changed

apis/search.jschanged
apis/search.jsView
@@ -9,8 +9,26 @@
99 return api('message', {id: opts.query})
1010 if(ref.isFeed(opts.query))
1111 return api('public', {id: opts.query})
1212
13+ if(/^@\w+$/.test(opts.query)) //is name
14+ return function (cb) {
15+ self.sbot.names.getSignifies(opts.query.substring(1), function (err, ids) {
16+ if(err) return cb(err)
17+ if(ids.length == 0)
18+ cb(null, ['h1', 'no feed named:'+opts.query])
19+ else if(ids.length == 1)
20+ cb(null, api('public', {author: ids[0].id}))
21+ else
22+ cb(null, ['div',
23+ ['div', opts.query + ' may also refer to:'].concat(ids.slice(1).map(function (e) {
24+ return api('avatar', {id: e.id, name: false})
25+ })),
26+ api('public', {author: ids[0].id})
27+ ])
28+ })
29+ }
30+
1331 return pull(
1432 self.sbot.search.query(opts),
1533 pull.map(function (data) {
1634 return api('message', data)
@@ -19,4 +37,8 @@
1937 }
2038
2139
2240
41+
42+
43+
44+

Built with git-ssb-web