Refactor GFM autocomplete emoji support and disable fuzzy matching for awards
!51972 (merged)
Closed in favor ofWhat does this MR do?
This MR disables fuzzy matching when searching for awards, per !45603 (comment 473730780), due to performance issues.
This MR refactors GFM autocomplete emoji support. Over the course of working on !42669 (merged), !45118 (merged), and !42797 (closed), it occured to me that the emoji autocomplete implementation could be streamlined. Some of the streamlining is improvement of code I wrote that is over complicated because I had misapprehensions about how the jQuery at-who module worked. @euko suggested I separate these changes from the introduction of fuzzy matching in !42797 (closed).
Some of my assumptions were wrong. I thought
atwho
would clobber extra fields passed through its system (fetch > filter > sort > template), but the data objects are preserved. As a consequence, I made some significant changes:
- The actual emoji data is never loaded into atwho. Atwho just passes that data to
filter
etc, so nowloadEmojiData
just loads a sentinel onceEmoji.initEmojiMap()
resolves.- The filter uses
Emoji.searchEmoji
directly, instead of filtering a preloaded array of names, etc.- The raw match data from
Emoji.searchEmoji
is passed through the entire pipeline, which eliminates the need for the lookup structure I constructed in !45118 (merged), or for lookups in the templating functions.- Instead of condensing to a single entry per emoji in
filter
by field priority, I letsorter
sort first by fuzzaldrin score and then remove any duplicate entries.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers - [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team