git ssb

16+

Dominic / patchbay



Commit ef284a7d4ac7cdcbae3a5c6e10265c539ae34bff

Include message ids in suggests/mentions

cel committed on 11/15/2016, 4:59:12 AM
Parent: da116a36a6e34b4499633c0a896b9bf32d263383

Files changed

modules_basic/names.jschanged
modules_basic/search-box.jschanged
modules_basic/suggest-mentions.jschanged
modules_core/tabs.jschanged
modules_basic/names.jsView
@@ -41,9 +41,9 @@
4141 value: {
4242 content: {
4343 type: "about",
4444 name: {"$prefix": ""},
45- about: {"$prefix": "@"} //better: match regexp.
45 + about: {"$prefix": ""}
4646 }
4747 }
4848 }
4949 }
@@ -82,11 +82,12 @@
8282 ts: {$max: 'ts'}
8383 }
8484 }
8585
86-function add_at(stream) {
86 +function add_sigil(stream) {
8787 return pull(stream, pull.map(function (e) {
88- if(!/^@/.test(e.name)) e.name = '@'+e.name
88 + if (e && e.id && e.name && e.id[0] !== e.name[0])
89 + e.name = e.id[0] + e.name
8990 return e
9091 })
9192 )
9293 }
@@ -95,9 +96,9 @@
9596 if(!err) {
9697 pull(
9798 many([
9899 sbot_links2({query: [filter, map, reduce]}),
99- add_at(sbot_query({query: [filter2, map2, reduce]}))
100 + add_sigil(sbot_query({query: [filter2, map2, reduce]}))
100101 ]),
101102 //reducing also ensures order by the lookup properties
102103 //in this case: [name, id]
103104 mfr.reduce(merge),
@@ -111,9 +112,9 @@
111112 )
112113
113114 pull(many([
114115 sbot_links2({query: [filter, map], old: false}),
115- add_at(sbot_query({query: [filter2, map2], old: false}))
116 + add_sigil(sbot_query({query: [filter2, map2], old: false}))
116117 ]),
117118 pull.drain(update))
118119 }
119120 }
modules_basic/search-box.jsView
@@ -71,9 +71,9 @@
7171 value: name,
7272 subtitle: chan.rank
7373 }
7474 }))
75- else if(/^@\w/.test(word)) {
75 + else if(/^[@%]\w/.test(word)) {
7676 signified(word, function (_, names) {
7777 cb(null, names.map(function (e) {
7878 return {
7979 title: e.name + ':'+e.id.substring(0, 10),
modules_basic/suggest-mentions.jsView
@@ -8,9 +8,9 @@
88 var blob_url = require('../plugs').first(exports.blob_url = [])
99 var signified = require('../plugs').first(exports.signified = [])
1010
1111 exports.suggest = cont.to(function (word, cb) {
12- if(!/^@\w/.test(word)) return cb()
12 + if(!/^[%&@]\w/.test(word)) return cb()
1313
1414
1515 signified(word, function (err, names) {
1616 if(err) cb(err)
modules_core/tabs.jsView
@@ -149,8 +149,14 @@
149149 case 51: // 3
150150 if (ev.shiftKey)
151151 search.activate('#', ev)
152152 return
153 +
154 + // navigate to a message
155 + case 53: // 5
156 + if (ev.shiftKey)
157 + search.activate('%', ev)
158 + return
153159 }
154160 })
155161
156162 // errors tab

Built with git-ssb-web