Skip to content

Commit 976dfb6

Browse files
authored
Kk/3119 indicate self in createdby filter (#3156)
* add logic to check if created by is user * fix linting issue * use ids instead of string match
1 parent fccf3da commit 976dfb6

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

client/src/components/Projects/ColumnHeaderPopups/TextPopup.jsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ const TextPopup = ({
8181
}) => {
8282
const userContext = useContext(UserContext);
8383
const property = header.accessor || header.id;
84+
const loggedInUserName = `${userContext?.account?.lastName}, ${userContext?.account?.firstName}`;
85+
8486
const getDisplayValue = value => {
8587
if (property === "droName" && value === "") {
8688
return "No DRO Assigned";
@@ -121,14 +123,15 @@ const TextPopup = ({
121123
selectOptions = droOptions.map(dro => dro.name);
122124
selectOptions.push("No DRO Assigned");
123125
} else if (property === "author" && droOptions) {
124-
const loggedInUserName = `${userContext?.account?.lastName}, ${userContext?.account?.firstName} (Me)`;
125126
let hasLoggedInUserInList = false;
126127

127128
selectOptions = [
128129
...new Set(
129130
filteredProjects.map(p => {
130131
const name = `${p.lastName}, ${p.firstName}`;
131-
if (name === loggedInUserName) hasLoggedInUserInList = true;
132+
if (p.loginId === userContext?.account?.id) {
133+
hasLoggedInUserInList = true;
134+
}
132135
return name;
133136
})
134137
)
@@ -281,6 +284,7 @@ const TextPopup = ({
281284

282285
{filteredOptions.map(o => {
283286
const checked = isChecked(o);
287+
284288
return (
285289
<div key={o} className={classes.listItem}>
286290
<ToggleCheckbox
@@ -295,7 +299,7 @@ const TextPopup = ({
295299
}
296300
label={o}
297301
/>
298-
<span>{o}</span>
302+
<span>{o === loggedInUserName ? `${o} (Me)` : o}</span>
299303
</div>
300304
);
301305
})}

0 commit comments

Comments
 (0)