Page MenuHomePhabricator

[lib] Utils for typeahead mentions
ClosedPublic

Authored by przemek on Nov 4 2022, 4:58 AM.
Tags
None
Referenced Files
F3381962: D5532.diff
Thu, Nov 28, 7:36 AM
Unknown Object (File)
Tue, Nov 19, 8:54 PM
Unknown Object (File)
Tue, Nov 19, 8:53 PM
Unknown Object (File)
Tue, Nov 19, 8:53 PM
Unknown Object (File)
Sat, Nov 9, 11:50 AM
Unknown Object (File)
Sat, Nov 9, 11:50 AM
Unknown Object (File)
Sat, Nov 9, 11:50 AM
Unknown Object (File)
Sat, Nov 9, 11:50 AM

Details

Summary

Preparation for typeahead user suggestions feature.
Utilities: - function getTypeaheadUserSuggestions() used to filter out users from current thread based on already typed prefix.

Also added stringForUserExplicit(), because when we use @-ing and we @ ourselves, we want to use our name, not "you",
e.g. I'd type: @przemek, instead od @you, which feels weird.

Test Plan

This is not called anywhere yet.
I runned web app and it still works the same.
Checked visibility of functions.

Diff Detail

Repository
rCOMM Comm
Branch
feat/mention
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

przemek edited the test plan for this revision. (Show Details)
tomek requested changes to this revision.Nov 4 2022, 8:45 AM
tomek added inline comments.
lib/shared/mention-utils.js
13–14

It would be safer to check if username is defined instead of depending on the external function. Also it isn't clear if that function is needed at all, because we're basically interested in just the users with username.

16

It is inefficient to iterate every user after every letter change. Please take a look at SearchIndex - can it be used here?

lib/shared/user-utils.js
18–36

It might be a good idea to make one function dependent on the other

This revision now requires changes to proceed.Nov 4 2022, 8:45 AM
tomek added inline comments.
lib/shared/mention-utils.js
20–24 ↗(On Diff #18179)

We can use a simpler syntax

This revision is now accepted and ready to land.Nov 8 2022, 4:24 AM

The test plan should include testing the existing stringForUser function

Fixed what inline pointed out.
Performed requested test.

This revision was automatically updated to reflect the committed changes.