Commit 7c83a74b23178a661998f2cad6192e20e95076f2
fix emoji suggest - 3.5.1
Ev Bogue committed on 10/8/2017, 3:44:47 PMParent: 3e1586c0f4e42c877a6e5f48b192f15cfdbec400
Files changed
client/modules/emoji.js | changed |
client/modules/index.js | changed |
client/modules/suggest-mentions.js | changed |
package.json | changed |
client/modules/emoji.js | ||
---|---|---|
@@ -7,14 +7,23 @@ | ||
7 | 7 … | |
8 | 8 … | exports.gives = { |
9 | 9 … | emoji_names: true, |
10 | 10 … | emoji_url: true, |
11 | - suggest_mentions: true | |
11 … | + //suggest_mentions: true | |
12 | 12 … | } |
13 | 13 … | |
14 | 14 … | exports.create = function (api) { |
15 | - return { | |
16 | - suggest_mentions: function (word) { | |
15 … | + return { | |
16 … | + | |
17 … | + emoji_names: function () { | |
18 … | + return emojiNames | |
19 … | + }, | |
20 … | + emoji_url: function (emoji) { | |
21 … | + return emoji in emojis && | |
22 … | + api.blob_url(emoji).replace(/\/blobs\/get/, '/img/emoji') + '.png' | |
23 … | + }, | |
24 … | + | |
25 … | + /* suggest_mentions: function (word) { | |
17 | 26 … | return function (cb) { |
18 | 27 … | if (word[0] !== ':' || word.length < 2) return cb() |
19 | 28 … | word = word.substr(1) |
20 | 29 … | if (word[word.length-1] === ':') word = word.substr(0, word.length-1) |
@@ -28,15 +37,8 @@ | ||
28 | 37 … | value: ':' + emoji + ':' |
29 | 38 … | } |
30 | 39 … | })) |
31 | 40 … | } |
32 | - }, | |
33 | - emoji_names: function () { | |
34 | - return emojiNames | |
35 | - }, | |
36 | - emoji_url: function (emoji) { | |
37 | - return emoji in emojis && | |
38 | - api.blob_url(emoji).replace(/\/blobs\/get/, '/img/emoji') + '.png' | |
39 | - } | |
41 … | + }*/ | |
40 | 42 … | } |
41 | 43 … | } |
42 | 44 … |
client/modules/index.js | ||
---|---|---|
@@ -12,8 +12,9 @@ | ||
12 | 12 … | "avatar-link.js": require('./avatar-link.js'), |
13 | 13 … | "avatar-name.js": require('./avatar-name.js'), |
14 | 14 … | "avatar-profile.js": require('./avatar-profile.js'), |
15 | 15 … | "avatar.js": require('./avatar.js'), |
16 … | + "emoji.js": require('./emoji.js'), | |
16 | 17 … | "compose.js": require('./compose.js'), |
17 | 18 … | "feed.js": require('./feed.js'), |
18 | 19 … | "follow.js": require('./follow.js'), |
19 | 20 … | "invite.js": require('./invite.js'), |
@@ -34,9 +35,8 @@ | ||
34 | 35 … | "suggest-mentions.js": require('./suggest-mentions.js'), |
35 | 36 … | "thread.js": require('./thread.js'), |
36 | 37 … | "timestamp.js": require('./timestamp.js'), |
37 | 38 … | "channel.js": require('./channel.js'), |
38 | - "emoji.js": require('./emoji.js'), | |
39 | 39 … | "nudge.js": require('./nudge.js'), |
40 | 40 … | "key.js": require('./key.js'), |
41 | 41 … | "notifications.js": require('./notifications.js'), |
42 | 42 … | "search.js": require('./search') |
client/modules/suggest-mentions.js | ||
---|---|---|
@@ -6,8 +6,10 @@ | ||
6 | 6 … | |
7 | 7 … | exports.needs = { |
8 | 8 … | sbot_links2: 'first', |
9 | 9 … | blob_url: 'first', |
10 … | + emoji_names: 'first', | |
11 … | + emoji_url: 'first', | |
10 | 12 … | signified: 'first', |
11 | 13 … | builtin_tabs: 'map' |
12 | 14 … | } |
13 | 15 … | |
@@ -20,8 +22,26 @@ | ||
20 | 22 … | |
21 | 23 … | return { |
22 | 24 … | suggest_mentions: function (word) { |
23 | 25 … | return function (cb) { |
26 … | + //emoji | |
27 … | + | |
28 … | + if (word[0] !== ':' || word.length < 2) return cb() | |
29 … | + word = word.substr(1) | |
30 … | + if (word[word.length-1] === ':') word = word.substr(0, word.length-1) | |
31 … | + cb(null, api.emoji_names().filter(function (name) { | |
32 … | + return name.substr(0, word.length) === word | |
33 … | + }).slice(0, 50).map(function (emoji) { | |
34 … | + return { | |
35 … | + image: api.emoji_url(emoji), | |
36 … | + title: emoji, | |
37 … | + subtitle: emoji, | |
38 … | + value: ':' + emoji + ':' | |
39 … | + } | |
40 … | + })) | |
41 … | + | |
42 … | + | |
43 … | + // names, repos, etc | |
24 | 44 … | if(!/^[%&@]\w/.test(word)) return cb() |
25 | 45 … | |
26 | 46 … | api.signified(word, function (err, names) { |
27 | 47 … | if(err) cb(err) |
package.json | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 … | { |
2 | 2 … | "name": "decent", |
3 | - "version": "3.5.0", | |
3 … | + "version": "3.5.1", | |
4 | 4 … | "description": "A decent(tralized) network for communication and development", |
5 | 5 … | "scripts": { |
6 | 6 … | "start": "node decent server", |
7 | 7 … | "build": "node client/scripts/style.js && mkdir -p build && browserify client/index.js | indexhtmlify > build/index.html", |
Built with git-ssb-web