Page MenuHomePhabricator

[lib/native/web] introduce createMemberMapForUserMentions function
ClosedPublic

Authored by ginsu on Oct 6 2023, 4:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jan 20, 7:02 AM
Unknown Object (File)
Mon, Jan 20, 7:02 AM
Unknown Object (File)
Mon, Jan 20, 7:02 AM
Unknown Object (File)
Mon, Jan 20, 7:02 AM
Unknown Object (File)
Mon, Jan 20, 4:57 AM
Unknown Object (File)
Sat, Jan 11, 5:42 PM
Unknown Object (File)
Thu, Jan 2, 7:50 AM
Unknown Object (File)
Sun, Dec 29, 3:19 PM
Subscribers

Details

Summary

This mini stack right here will deal with making the @mention of a user a touchable that will navigate to the user profile whenever onPress is called.

This is step 1 in the list below
Outlined below are the steps I will take to make @metion of a user into a touchable

  1. Introduce createMemberMapForUserMentions function (Right now we only store a set of usernames but we also will want to know the id of the user based on the username)
  2. Introduce parseUserMentions function (We will use this function to get and return a userID from the membersMap)
  3. Introduce userProfileBottomSheetActive state to the markdown context (This will be used for disabling the press to focus on a message functionality)
  4. Introduce MarkdownUserMention component (this will render the touchable that will navigate to the user profile)

Depends on D9390

Test Plan

flow and confirmed that there were no regressions with @mention of a user

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ginsu requested review of this revision.Oct 6 2023, 5:02 AM
atul added inline comments.
lib/shared/markdown.js
203–210 ↗(On Diff #31738)

Could also do something like

const filteredMembers = members
  .filter(member => member.role && member.username)
  .map(member => [member.username.toLowerCase(), member.id]);

return new Map<string, string>(filteredMembers);

which imo is a bit easier to read + less indentation, but up to you

This revision is now accepted and ready to land.Oct 9 2023, 1:26 PM