Sanitize away underscores and asterisks for display names
This commit is contained in:
parent
b2c821991d
commit
7819229db6
|
@ -27,10 +27,11 @@ export const alternateEventBtnStr = 'Join as Alternate';
|
|||
export const noDescProvided = 'No description provided.';
|
||||
|
||||
// Member List generators
|
||||
const escapeMemberNameForDisplay = (input: string): string => input.replace(/[_*]/g, '\\$&');
|
||||
export const generateMemberTitle = (memberList: Array<LFGMember>, maxMembers: number): string => `Members Joined: ${memberList.length}/${maxMembers}`;
|
||||
export const generateMemberList = (memberList: Array<LFGMember>): string => memberList.length ? memberList.map((member) => `\`${member.name}\` - <@${member.id}>`).join('\n') : noMembersStr;
|
||||
export const generateMemberList = (memberList: Array<LFGMember>): string => memberList.length ? memberList.map((member) => `${escapeMemberNameForDisplay(member.name)} - <@${member.id}>`).join('\n') : noMembersStr;
|
||||
export const generateAlternateList = (alternateList: Array<LFGMember>): string =>
|
||||
alternateList.length ? alternateList.map((member) => `\`${member.name}\` - <@${member.id}>${member.joined ? ' *' : ''}`).join('\n') : noMembersStr;
|
||||
alternateList.length ? alternateList.map((member) => `${escapeMemberNameForDisplay(member.name)} - <@${member.id}>${member.joined ? ' *' : ''}`).join('\n') : noMembersStr;
|
||||
|
||||
// Fields for event creation and editing modals
|
||||
export const eventTimeId = 'eventTime';
|
||||
|
|
Loading…
Reference in New Issue