Commit ef284a7d4ac7cdcbae3a5c6e10265c539ae34bff
Include message ids in suggests/mentions
cel committed on 11/15/2016, 4:59:12 AMParent: da116a36a6e34b4499633c0a896b9bf32d263383
Files changed
modules_basic/names.js | changed |
modules_basic/search-box.js | changed |
modules_basic/suggest-mentions.js | changed |
modules_core/tabs.js | changed |
modules_basic/names.js | ||
---|---|---|
@@ -41,9 +41,9 @@ | ||
41 | 41 … | value: { |
42 | 42 … | content: { |
43 | 43 … | type: "about", |
44 | 44 … | name: {"$prefix": ""}, |
45 | - about: {"$prefix": "@"} //better: match regexp. | |
45 … | + about: {"$prefix": ""} | |
46 | 46 … | } |
47 | 47 … | } |
48 | 48 … | } |
49 | 49 … | } |
@@ -82,11 +82,12 @@ | ||
82 | 82 … | ts: {$max: 'ts'} |
83 | 83 … | } |
84 | 84 … | } |
85 | 85 … | |
86 | -function add_at(stream) { | |
86 … | +function add_sigil(stream) { | |
87 | 87 … | 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 | |
89 | 90 … | return e |
90 | 91 … | }) |
91 | 92 … | ) |
92 | 93 … | } |
@@ -95,9 +96,9 @@ | ||
95 | 96 … | if(!err) { |
96 | 97 … | pull( |
97 | 98 … | many([ |
98 | 99 … | sbot_links2({query: [filter, map, reduce]}), |
99 | - add_at(sbot_query({query: [filter2, map2, reduce]})) | |
100 … | + add_sigil(sbot_query({query: [filter2, map2, reduce]})) | |
100 | 101 … | ]), |
101 | 102 … | //reducing also ensures order by the lookup properties |
102 | 103 … | //in this case: [name, id] |
103 | 104 … | mfr.reduce(merge), |
@@ -111,9 +112,9 @@ | ||
111 | 112 … | ) |
112 | 113 … | |
113 | 114 … | pull(many([ |
114 | 115 … | 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})) | |
116 | 117 … | ]), |
117 | 118 … | pull.drain(update)) |
118 | 119 … | } |
119 | 120 … | } |
modules_basic/search-box.js | |||
---|---|---|---|
@@ -71,9 +71,9 @@ | |||
71 | 71 … | value: name, | |
72 | 72 … | subtitle: chan.rank | |
73 | 73 … | } | |
74 | 74 … | })) | |
75 | - else if(/^@\w/.test(word)) { | ||
75 … | + else if(/^[@%]\w/.test(word)) { | ||
76 | 76 … | signified(word, function (_, names) { | |
77 | 77 … | cb(null, names.map(function (e) { | |
78 | 78 … | return { | |
79 | 79 … | title: e.name + ':'+e.id.substring(0, 10), |
modules_basic/suggest-mentions.js | ||
---|---|---|
@@ -8,9 +8,9 @@ | ||
8 | 8 … | var blob_url = require('../plugs').first(exports.blob_url = []) |
9 | 9 … | var signified = require('../plugs').first(exports.signified = []) |
10 | 10 … | |
11 | 11 … | exports.suggest = cont.to(function (word, cb) { |
12 | - if(!/^@\w/.test(word)) return cb() | |
12 … | + if(!/^[%&@]\w/.test(word)) return cb() | |
13 | 13 … | |
14 | 14 … | |
15 | 15 … | signified(word, function (err, names) { |
16 | 16 … | if(err) cb(err) |
modules_core/tabs.js | ||
---|---|---|
@@ -149,8 +149,14 @@ | ||
149 | 149 … | case 51: // 3 |
150 | 150 … | if (ev.shiftKey) |
151 | 151 … | search.activate('#', ev) |
152 | 152 … | return |
153 … | + | |
154 … | + // navigate to a message | |
155 … | + case 53: // 5 | |
156 … | + if (ev.shiftKey) | |
157 … | + search.activate('%', ev) | |
158 … | + return | |
153 | 159 … | } |
154 | 160 … | }) |
155 | 161 … | |
156 | 162 … | // errors tab |
Built with git-ssb-web