-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: update parent action for assignee report as well #24110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
313d2e5
9728aa2
574c144
24a3870
1e380ae
abff057
a5eac40
688217f
d4dd964
fbed766
6a977fd
fafcfa9
99018a5
c474825
e87bed8
a5f4dfb
2e3f28e
5152ef3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,7 +207,13 @@ function createTaskAndNavigate(parentReportID, title, description, assignee, ass | |
| Navigation.dismissModal(optimisticTaskReport.reportID); | ||
| } | ||
|
|
||
| function completeTask(taskReportID, taskTitle) { | ||
| /** | ||
| * Complete a task | ||
| * @param {Object} taskReport task report | ||
| * @param {String} taskTitle Title of the task | ||
| */ | ||
| function completeTask(taskReport, taskTitle) { | ||
| const taskReportID = taskReport.reportID; | ||
| const message = `completed task: ${taskTitle}`; | ||
| const completedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED, message); | ||
|
|
||
|
|
@@ -260,9 +266,25 @@ function completeTask(taskReportID, taskTitle) { | |
| ]; | ||
|
|
||
| // Update optimistic data for parent report action | ||
| const optimisticParentReportData = ReportUtils.getOptimisticDataForParentReportAction(taskReportID, completedTaskReportAction.created, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); | ||
| if (!_.isEmpty(optimisticParentReportData)) { | ||
| optimisticData.push(optimisticParentReportData); | ||
| const optimisticDataForParentReportAction = ReportUtils.getOptimisticDataForParentReportAction(taskReportID, completedTaskReportAction.created, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); | ||
|
techievivek marked this conversation as resolved.
|
||
| if (!_.isEmpty(optimisticDataForParentReportAction)) { | ||
| optimisticData.push(optimisticDataForParentReportAction); | ||
| } | ||
|
|
||
| // Multiple report actions can link to the same child. Both share destination (task parent) and assignee report link to the same report action. | ||
|
dummy-1111 marked this conversation as resolved.
|
||
| // We need to find and update the other parent report action (in assignee report). More info https://github.com/Expensify/App/issues/23920#issuecomment-1663092717 | ||
| const assigneeReportAction = ReportUtils.getTaskParentReportActionIDInAssigneeReport(taskReport); | ||
|
techievivek marked this conversation as resolved.
|
||
| if (!_.isEmpty(assigneeReportAction)) { | ||
| const optimisticDataForClonedParentReportAction = ReportUtils.getOptimisticDataForParentReportAction( | ||
| taskReportID, | ||
| completedTaskReportAction.created, | ||
| CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, | ||
| assigneeReportAction.reportID, | ||
| assigneeReportAction.reportActionID, | ||
| ); | ||
| if (!_.isEmpty(optimisticDataForClonedParentReportAction)) { | ||
| optimisticData.push(optimisticDataForClonedParentReportAction); | ||
| } | ||
| } | ||
|
|
||
| API.write( | ||
|
|
@@ -276,11 +298,12 @@ function completeTask(taskReportID, taskTitle) { | |
| } | ||
|
|
||
| /** | ||
| * Reopens a closed task | ||
| * @param {string} taskReportID ReportID of the task | ||
| * @param {string} taskTitle Title of the task | ||
| * Reopen a closed task | ||
| * @param {Object} taskReport task report | ||
| * @param {String} taskTitle Title of the task | ||
| */ | ||
| function reopenTask(taskReportID, taskTitle) { | ||
| function reopenTask(taskReport, taskTitle) { | ||
| const taskReportID = taskReport.reportID; | ||
| const message = `reopened task: ${taskTitle}`; | ||
| const reopenedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, CONST.REPORT.ACTIONS.TYPE.TASKREOPENED, message); | ||
|
|
||
|
|
@@ -336,9 +359,25 @@ function reopenTask(taskReportID, taskTitle) { | |
| ]; | ||
|
|
||
| // Update optimistic data for parent report action | ||
| const optimisticParentReportData = ReportUtils.getOptimisticDataForParentReportAction(taskReportID, reopenedTaskReportAction.created, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); | ||
| if (!_.isEmpty(optimisticParentReportData)) { | ||
| optimisticData.push(optimisticParentReportData); | ||
| const optimisticDataForParentReportAction = ReportUtils.getOptimisticDataForParentReportAction(taskReportID, reopenedTaskReportAction.created, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coming from #25548
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @eVoloshchak I didn't read the whole issue context but isn't the approved PR reintroducing the fixed bug here #23920?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @s77rt, we aren't counting completing/opening a task as a reply anymore (recent BE update), so this logic isn't needed |
||
| if (!_.isEmpty(optimisticDataForParentReportAction)) { | ||
| optimisticData.push(optimisticDataForParentReportAction); | ||
| } | ||
|
|
||
| // Multiple report actions can link to the same child. Both share destination (task parent) and assignee report link to the same report action. | ||
| // We need to find and update the other parent report action (in assignee report). More info https://github.com/Expensify/App/issues/23920#issuecomment-1663092717 | ||
| const assigneeReportAction = ReportUtils.getTaskParentReportActionIDInAssigneeReport(taskReport); | ||
| if (!_.isEmpty(assigneeReportAction)) { | ||
| const optimisticDataForClonedParentReportAction = ReportUtils.getOptimisticDataForParentReportAction( | ||
| taskReportID, | ||
| reopenedTaskReportAction.created, | ||
| CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, | ||
| assigneeReportAction.reportID, | ||
| assigneeReportAction.reportActionID, | ||
| ); | ||
| if (!_.isEmpty(optimisticDataForClonedParentReportAction)) { | ||
| optimisticData.push(optimisticDataForClonedParentReportAction); | ||
| } | ||
| } | ||
|
|
||
| API.write( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.