Skip to content

Commit

Permalink
[frontend] add current user if is not displayed (#4333)
Browse files Browse the repository at this point in the history
  • Loading branch information
frapuks committed Nov 4, 2024
1 parent 3e0f5a7 commit 961f422
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ const ObjectAssigneeField: FunctionComponent<ObjectAssigneeFieldProps> = ({
// Sort by alphabetic order
return a.label.localeCompare(b.label);
});
// Add current user if is not in the only first results displayed
const isMeDisplayed = newAssignees.find((assignee) => assignee.value === me?.id);
if (me && !isMeDisplayed) newAssignees.unshift({ label: me.name, value: me.id, type: 'User' });
setAssignees(newAssignees);
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ const ObjectParticipantField: FunctionComponent<ObjectParticipantFieldProps> = (
// Sort by alphabetic order
return a.label.localeCompare(b.label);
});
// Add current user if is not in the only first results displayed
const isMeDisplayed = newParticipants.find((participant) => participant.value === me?.id);
if (me && !isMeDisplayed) newParticipants.unshift({ label: me.name, value: me.id, type: 'User' });
setParticipants(newParticipants);
});
};
Expand Down

0 comments on commit 961f422

Please sign in to comment.