Page MenuHomePhabricator

[native] Show chats in mention typeahead tooltip
ClosedPublic

Authored by patryk on Aug 22 2023, 5:26 AM.
Tags
None
Referenced Files
F3140626: D8910.id30216.diff
Sun, Nov 3, 4:58 AM
Unknown Object (File)
Mon, Oct 28, 2:46 PM
Unknown Object (File)
Thu, Oct 24, 3:02 AM
Unknown Object (File)
Wed, Oct 23, 7:47 PM
Unknown Object (File)
Tue, Oct 22, 6:42 AM
Unknown Object (File)
Sun, Oct 20, 4:16 AM
Unknown Object (File)
Sun, Oct 13, 9:08 PM
Unknown Object (File)
Sun, Oct 13, 5:16 PM
Subscribers

Details

Summary

Solution for ENG-4550.

This diff enables showing chats in typeahead tooltip.

Depends on D8909.

Test Plan

Test if tooltip:

  1. contains chat names
  2. doesn't contain chat in which we currently are
  3. changes its content depending on text prefix

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

patryk held this revision as a draft.
patryk edited the test plan for this revision. (Show Details)
patryk added reviewers: tomek, inka, rohan.
native/utils/typeahead-utils.js
9 ↗(On Diff #30216)

This regex has one drawback: when we type '@' in chat input bar, getMentionTypeahead(User/Chat)Suggestions will always execute. But there is no way to avoid this -> previously when we me mentioned users only we could stop SearchIndex lookup when user types space after mention -> right now when threads can have spaces it's impossible. validChatNameRegexString has a limitation to 191 chars, so when user types a very long message after mention, eventually it will stop executing mention utilities.

const suggestions = [
  ...suggestedUsers.map(user => ({ type: 'user', user })),
  ...suggestedChats.map(chat => ({ type: 'chat', chat })),
];

This map can be omitted by changing return type of getMentionTypeahead(User/Chat)Suggestions function.

Rebase and match refactored component style

lib/shared/mention-utils.js
115 ↗(On Diff #30293)

Can you make a Set out of this to make the search in line 118 constant instead of linear?

Refactor getMentionTypeaheadChatSuggestions

native/utils/typeahead-utils.js
19

Same question: isn't oldValidUsernameRegexString a subset of validChatNameRegexString?

lib/shared/mention-utils.js
133

Does the ordering of the result matter? Are the results sorted?

native/chat/chat-input-bar.react.js
578

Is it a good idea that we them in this order?

lib/shared/mention-utils.js
133

Results are not sorted, but we might want to sort them like we do for user candidates.

native/chat/chat-input-bar.react.js
578

Last sentence of this comment states that we need to show user mentions before chat mentions. But what we could do is to sort suggestions array and place user mentions before chat mentions (if mention text is the same).

native/utils/typeahead-utils.js
19

Yes it is, will remove it

Remove oldValidUsernameRegexString from mention regex

tomek added inline comments.
lib/shared/mention-utils.js
115 ↗(On Diff #31254)

Maybe chatNamePrefix?

This revision is now accepted and ready to land.Sep 26 2023, 7:50 AM

Modify getMentionTypeaheadChatSuggestions