-
-
Notifications
You must be signed in to change notification settings - Fork 2
TT-6957 Enhance OrgHead component to sanitize organization names in display #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -85,6 +85,18 @@ export const OrgHead = () => { | |||||||||||||||||||
| setOpenMember(true); | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const cleanOrgName = (orgRec: OrganizationD | undefined) => { | ||||||||||||||||||||
| let name = orgRec?.attributes.name; | ||||||||||||||||||||
| if (!name) return ''; | ||||||||||||||||||||
| if (name.startsWith('>')) { | ||||||||||||||||||||
| name = name.slice(1); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| if (name.endsWith('<')) { | ||||||||||||||||||||
| name = name.slice(0, -1); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| return name; | ||||||||||||||||||||
|
Comment on lines
+91
to
+97
|
||||||||||||||||||||
| if (name.startsWith('>')) { | |
| name = name.slice(1); | |
| } | |
| if (name.endsWith('<')) { | |
| name = name.slice(0, -1); | |
| } | |
| return name; | |
| // Remove all leading '>' and all trailing '<' characters, but leave any in the middle | |
| return name.replace(/^>+/, '').replace(/<+$/, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing blank line before the third test case (testing name with both prefix and suffix). Adding a blank line here would improve readability and maintain consistency with the structure of the previous two test cases within this test.