Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Aug 14, 2024
1 parent 3633559 commit 1530104
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,14 @@ function setAssigneeValue(
skipShareDestination = false,
): OnyxEntry<OnyxTypes.Report> | undefined {
let report: OnyxEntry<OnyxTypes.Report> | 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]);
Expand All @@ -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
Expand Down

0 comments on commit 1530104

Please sign in to comment.