Page MenuHomePhabricator

[native] Show chats in mention typeahead tooltip
ClosedPublic

Authored by patryk on Aug 22 2023, 5:26 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 10:05 AM
Unknown Object (File)
Wed, Nov 20, 6:20 AM
Unknown Object (File)
Wed, Nov 20, 3:35 AM
Unknown Object (File)
Sun, Nov 10, 1:50 AM
Unknown Object (File)
Sat, Nov 9, 12:41 PM
Unknown Object (File)
Sat, Nov 9, 12:28 PM
Unknown Object (File)
Sat, Nov 9, 12:22 PM
Unknown Object (File)
Sat, Nov 9, 11:51 AM
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