From 0c3ce41031d292734e0e4cc70d227228d1993bea Mon Sep 17 00:00:00 2001 From: "Renato \"Lond\" Cerqueira" Date: Thu, 7 Jun 2018 19:40:23 +0200 Subject: Update to emojimart 2.6.1 (#7746) * Update to emojimart 2.6.1 WIP using local updated version. Sheet comes from emoji-data@4.0.4, file sheet_twitter_32_indexed_256.png. * Update to 2.6.1 and uncompress data if needed * Remove changes that were not needed * Fix yarn lock file * Match emojiToShowFilter behavior to new version of emoji-mart * Fix codeclimate issue * Match custom emoji behavior to new version of emoji-mart * Replace emoji without shortcode in tests * Fix code climate issues --- yarn.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'yarn.lock') diff --git a/yarn.lock b/yarn.lock index 097e7706d..853e61b37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2304,8 +2304,8 @@ elliptic@^6.0.0: minimalistic-crypto-utils "^1.0.0" emoji-mart@Gargron/emoji-mart#build: - version "2.1.4" - resolved "https://codeload.github.com/Gargron/emoji-mart/tar.gz/a5e1afe5ebcf2841e611d20d261b029581cbe051" + version "2.6.1" + resolved "https://codeload.github.com/Gargron/emoji-mart/tar.gz/227c56c8a1cd89a475d4cf8d9605096555e12484" emoji-regex@^6.1.0: version "6.5.1" -- cgit From 85470ec872a39c475d872f685dadeac849832a98 Mon Sep 17 00:00:00 2001 From: "Renato \"Lond\" Cerqueira" Date: Fri, 8 Jun 2018 13:28:04 +0200 Subject: Fix issues with updated emoji mart (#7761) * Changes behavior from search light to keep custom search The new version of emoji-mart needs the search function to constantly receive the custom emoji array. This changes the behavior back to the previous one in the search light method to keep the emoji autocomplete as before * Change test order The order was breaking the tests * Fix codeclimate issues * Update to emoji mart to version without issue in picker Fixes #7760 --- .../features/emoji/__tests__/emoji_index-test.js | 40 ++++++++++++++++++---- .../features/emoji/emoji_mart_search_light.js | 10 ++++-- yarn.lock | 2 +- 3 files changed, 41 insertions(+), 11 deletions(-) (limited to 'yarn.lock') diff --git a/app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js b/app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js index bd63d91b3..9df2d34a0 100644 --- a/app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js +++ b/app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js @@ -44,7 +44,12 @@ describe('emoji_index', () => { expect(emojiIndex.search('apple').map(trimEmojis)).toEqual(expected); }); - it('erases custom emoji if not passed again', () => { + it('can include/exclude categories', () => { + expect(search('flag', { include: ['people'] })).toEqual([]); + expect(emojiIndex.search('flag', { include: ['people'] })).toEqual([]); + }); + + it('(different behavior from emoji-mart) do not erases custom emoji if not passed again', () => { const custom = [ { id: 'mastodon', @@ -60,7 +65,33 @@ describe('emoji_index', () => { search('', { custom }); emojiIndex.search('', { custom }); const expected = []; - expect(search('masto').map(trimEmojis)).toEqual(expected); + const lightExpected = [ + { + id: 'mastodon', + custom: true, + }, + ]; + expect(search('masto').map(trimEmojis)).toEqual(lightExpected); + expect(emojiIndex.search('masto').map(trimEmojis)).toEqual(expected); + }); + + it('(different behavior from emoji-mart) erases custom emoji if another is passed', () => { + const custom = [ + { + id: 'mastodon', + name: 'mastodon', + short_names: ['mastodon'], + text: '', + emoticons: [], + keywords: ['mastodon'], + imageUrl: 'http://example.com', + custom: true, + }, + ]; + search('', { custom }); + emojiIndex.search('', { custom }); + const expected = []; + expect(search('masto', { custom: [] }).map(trimEmojis)).toEqual(expected); expect(emojiIndex.search('masto').map(trimEmojis)).toEqual(expected); }); @@ -97,11 +128,6 @@ describe('emoji_index', () => { .not.toContain('pineapple'); }); - it('can include/exclude categories', () => { - expect(search('flag', { include: ['people'] })).toEqual([]); - expect(emojiIndex.search('flag', { include: ['people'] })).toEqual([]); - }); - it('does an emoji whose unified name is irregular', () => { const expected = [ { diff --git a/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js b/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js index bf511d290..36351ec02 100644 --- a/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js +++ b/app/javascript/mastodon/features/emoji/emoji_mart_search_light.js @@ -54,9 +54,13 @@ function addCustomToPool(custom, pool) { index = {}; } -function search(value, { emojisToShowFilter, maxResults, include, exclude, custom = [] } = {}) { - if (customEmojisList !== custom) - addCustomToPool(custom, originalPool); +function search(value, { emojisToShowFilter, maxResults, include, exclude, custom } = {}) { + if (custom !== undefined) { + if (customEmojisList !== custom) + addCustomToPool(custom, originalPool); + } else { + custom = []; + } maxResults = maxResults || 75; include = include || []; diff --git a/yarn.lock b/yarn.lock index 853e61b37..ba289d5ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2305,7 +2305,7 @@ elliptic@^6.0.0: emoji-mart@Gargron/emoji-mart#build: version "2.6.1" - resolved "https://codeload.github.com/Gargron/emoji-mart/tar.gz/227c56c8a1cd89a475d4cf8d9605096555e12484" + resolved "https://codeload.github.com/Gargron/emoji-mart/tar.gz/829d042f1c059b15050e5acb3c77adf1a851c666" emoji-regex@^6.1.0: version "6.5.1" -- cgit From a043f8d27747ded9a5636d14aff36d7d4ffbac18 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 9 Jun 2018 21:10:53 +0200 Subject: Ensure emoji-mart dependency is updated (#7771) Regression from 85470ec since version string was not updated --- yarn.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'yarn.lock') diff --git a/yarn.lock b/yarn.lock index ba289d5ce..641835149 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2304,8 +2304,8 @@ elliptic@^6.0.0: minimalistic-crypto-utils "^1.0.0" emoji-mart@Gargron/emoji-mart#build: - version "2.6.1" - resolved "https://codeload.github.com/Gargron/emoji-mart/tar.gz/829d042f1c059b15050e5acb3c77adf1a851c666" + version "2.6.2" + resolved "https://codeload.github.com/Gargron/emoji-mart/tar.gz/ff00dc470b5b2d9f145a6d6e977a54de5df2b4c9" emoji-regex@^6.1.0: version "6.5.1" -- cgit