From 3633559bbbcc09f1eca53e84548c30bbf0d559e1 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 13 Aug 2024 10:29:53 +0700 Subject: [PATCH 1/2] fix: Selecting yourself as the assignee should default Share somewhere to your self-DM --- src/libs/actions/Task.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libs/actions/Task.ts b/src/libs/actions/Task.ts index 81e6beea4486..774a57450c04 100644 --- a/src/libs/actions/Task.ts +++ b/src/libs/actions/Task.ts @@ -798,6 +798,13 @@ function setAssigneeValue( if (!shareToReportID && !skipShareDestination) { setShareDestinationValue(report?.reportID ?? '-1'); } + } else { + const selfDMReportID = ReportUtils.findSelfDMReportID(); + // If there is no share destination set, automatically set it to the assignee chat report + // This allows for a much quicker process when creating a new task and is likely the desired share destination most times + if (!shareToReportID && !skipShareDestination) { + setShareDestinationValue(selfDMReportID ?? '-1'); + } } // This is only needed for creation of a new task and so it should only be stored locally From 15301041f72928709d3815a41ccf9bddaef14d9a Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 14 Aug 2024 10:09:28 +0700 Subject: [PATCH 2/2] clean code --- src/libs/actions/Task.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libs/actions/Task.ts b/src/libs/actions/Task.ts index 774a57450c04..6105b7cffd9e 100644 --- a/src/libs/actions/Task.ts +++ b/src/libs/actions/Task.ts @@ -774,7 +774,14 @@ function setAssigneeValue( skipShareDestination = false, ): OnyxEntry | undefined { let report: OnyxEntry | undefined = chatReport; - if (!isCurrentUser) { + if (isCurrentUser) { + const selfDMReportID = ReportUtils.findSelfDMReportID(); + // If there is no share destination set, automatically set it to the assignee chat report + // This allows for a much quicker process when creating a new task and is likely the desired share destination most times + if (!shareToReportID && !skipShareDestination) { + setShareDestinationValue(selfDMReportID ?? '-1'); + } + } else { // Check for the chatReport by participants IDs if (!report) { report = ReportUtils.getChatByParticipants([assigneeAccountID, currentUserAccountID]); @@ -798,13 +805,6 @@ function setAssigneeValue( if (!shareToReportID && !skipShareDestination) { setShareDestinationValue(report?.reportID ?? '-1'); } - } else { - const selfDMReportID = ReportUtils.findSelfDMReportID(); - // If there is no share destination set, automatically set it to the assignee chat report - // This allows for a much quicker process when creating a new task and is likely the desired share destination most times - if (!shareToReportID && !skipShareDestination) { - setShareDestinationValue(selfDMReportID ?? '-1'); - } } // This is only needed for creation of a new task and so it should only be stored locally