Skip to content

Commit

Permalink
Merge pull request Expensify#47138 from tsa321/fixTwoCreatedActionOnA…
Browse files Browse the repository at this point in the history
…ssignTask

Fix two created action generated on assign task from QAB casusing UX glitch
  • Loading branch information
Julesssss authored Aug 19, 2024
2 parents 273273a + eb61f33 commit 81998f6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,7 @@ function buildPolicyData(policyOwnerEmail = '', makeMeAdmin = false, policyName
addWorkspaceRoom: null,
},
pendingAction: null,
isOptimisticReport: false,
},
},
{
Expand All @@ -1705,6 +1706,7 @@ function buildPolicyData(policyOwnerEmail = '', makeMeAdmin = false, policyName
},
pendingAction: null,
pendingChatMembers: [],
isOptimisticReport: false,
},
},
{
Expand All @@ -1724,6 +1726,7 @@ function buildPolicyData(policyOwnerEmail = '', makeMeAdmin = false, policyName
addWorkspaceRoom: null,
},
pendingAction: null,
isOptimisticReport: false,
},
},
{
Expand Down
12 changes: 12 additions & 0 deletions src/libs/actions/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,17 @@ function clearOutTaskInfoAndNavigate(reportID?: string, chatReport?: OnyxEntry<O
Navigation.navigate(ROUTES.NEW_TASK_DETAILS);
}

/**
* Start out create task action quick action step
*/
function startOutCreateTaskQuickAction(reportID: string, targetAccountID: number) {
// The second parameter of clearOutTaskInfoAndNavigate is the chat report or DM report
// between the user and the person to whom the task is assigned.
// Since chatReportID isn't stored in NVP_QUICK_ACTION_GLOBAL_CREATE, we set
// it to undefined. This will make setAssigneeValue to search for the correct report.
clearOutTaskInfoAndNavigate(reportID, undefined, targetAccountID, true);
}

/**
* Get the assignee data
*/
Expand Down Expand Up @@ -1162,6 +1173,7 @@ export {
reopenTask,
completeTask,
clearOutTaskInfoAndNavigate,
startOutCreateTaskQuickAction,
getAssignee,
getShareDestination,
deleteTask,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,7 @@ function FloatingActionButtonAndPopover(
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.PAY, quickActionReportID, CONST.IOU.REQUEST_TYPE.MANUAL, true), false);
return;
case CONST.QUICK_ACTIONS.ASSIGN_TASK:
selectOption(
() => Task.clearOutTaskInfoAndNavigate(isValidReport ? quickActionReportID : '', isValidReport ? quickActionReport : undefined, quickAction.targetAccountID ?? -1, true),
false,
);
selectOption(() => Task.startOutCreateTaskQuickAction(isValidReport ? quickActionReportID : '', quickAction.targetAccountID ?? -1), false);
break;
case CONST.QUICK_ACTIONS.TRACK_MANUAL:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.TRACK, quickActionReportID, CONST.IOU.REQUEST_TYPE.MANUAL, true), false);
Expand Down

0 comments on commit 81998f6

Please sign in to comment.