Skip to content

Commit

Permalink
only add the invalid mention as title if it's not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Sep 28, 2024
1 parent 6e0410f commit 70e390d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/pages/home/report/ReportFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,20 @@ function ReportFooter({

let assignee: OnyxEntry<OnyxTypes.PersonalDetails>;
let assigneeChatReport;
if (isValidMention) {
assignee = Object.values(allPersonalDetails).find((value) => value?.login === mentionWithDomain) ?? undefined;
if (!Object.keys(assignee ?? {}).length) {
const assigneeAccountID = UserUtils.generateAccountID(mentionWithDomain);
const optimisticDataForNewAssignee = Task.setNewOptimisticAssignee(mentionWithDomain, assigneeAccountID);
assignee = optimisticDataForNewAssignee.assignee;
assigneeChatReport = optimisticDataForNewAssignee.assigneeReport;
if (mentionWithDomain) {
if (isValidMention) {
assignee = Object.values(allPersonalDetails).find((value) => value?.login === mentionWithDomain) ?? undefined;
if (!Object.keys(assignee ?? {}).length) {
const assigneeAccountID = UserUtils.generateAccountID(mentionWithDomain);
const optimisticDataForNewAssignee = Task.setNewOptimisticAssignee(mentionWithDomain, assigneeAccountID);
assignee = optimisticDataForNewAssignee.assignee;
assigneeChatReport = optimisticDataForNewAssignee.assigneeReport;
}
} else {
// If the mention is not valid, include it on the title.
// The mention could be invalid if it's a short mention and failed to be converted to a full mention.
title = `@${mentionWithDomain} ${title}`;
}
} else {
// If the mention is not valid, include it on the title.
// The mention could be invalid if it's a short mention and failed to be converted to a full mention.
title = `@${mentionWithDomain} ${title}`;
}
Task.createTaskAndNavigate(report.reportID, title, '', assignee?.login ?? '', assignee?.accountID, assigneeChatReport, report.policyID);
return true;
Expand Down

0 comments on commit 70e390d

Please sign in to comment.