Skip to content

Refactor GFM autocomplete emoji support and disable fuzzy matching for awards

Closed in favor of !51972 (merged)

What 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:

  1. The actual emoji data is never loaded into atwho. Atwho just passes that data to filter etc, so now loadEmojiData just loads a sentinel once Emoji.initEmojiMap() resolves.
  2. The filter uses Emoji.searchEmoji directly, instead of filtering a preloaded array of names, etc.
  3. 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.
  4. Instead of condensing to a single entry per emoji in filter by field priority, I let sorter sort first by fuzzaldrin score and then remove any duplicate entries.

!42797 (comment 429797095)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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
Edited by Ethan Reesor

Merge request reports