-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Move task reportActions onto the task report #20014
Changes from all commits
7985bcd
9cb8051
3474701
9df0edb
859c002
22a4177
1f26a5c
9626322
1dec3d0
95978db
8ac7e15
22a1eeb
ba0abb1
3e798cd
7589989
8933e76
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 |
---|---|---|
|
@@ -1273,9 +1273,9 @@ export default { | |
task: { | ||
completed: 'Completed', | ||
messages: { | ||
completed: 'Completed task', | ||
canceled: 'Canceled task', | ||
reopened: 'Reopened task', | ||
completed: 'completed task', | ||
canceled: 'canceled task', | ||
reopened: 'reopened task', | ||
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. Should we change the lowercase for Spanish too? 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. Oh whoops, good callout |
||
}, | ||
}, | ||
statementPage: { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,8 +170,8 @@ function createTaskAndNavigate(currentUserEmail, parentReportID, title, descript | |
Navigation.navigate(ROUTES.getReportRoute(optimisticTaskReport.reportID)); | ||
} | ||
|
||
function completeTask(taskReportID, parentReportID, taskTitle) { | ||
const message = `Completed task: ${taskTitle}`; | ||
function completeTask(taskReportID, taskTitle) { | ||
const message = `completed task: ${taskTitle}`; | ||
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. NAB: I preferred sentence case but I guess we had a good reason to change it? 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. Yup, keeping it consistent with manual requests |
||
const completedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED, message); | ||
|
||
const optimisticData = [ | ||
|
@@ -183,18 +183,10 @@ function completeTask(taskReportID, parentReportID, taskTitle) { | |
statusNum: CONST.REPORT.STATUS.APPROVED, | ||
}, | ||
}, | ||
|
||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`, | ||
value: { | ||
lastVisibleActionCreated: completedTaskReportAction.created, | ||
lastMessageText: message, | ||
lastActorEmail: completedTaskReportAction.actorEmail, | ||
}, | ||
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, | ||
Comment on lines
-188
to
-197
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. The task report is a child, whenever it's updated we should also update the parent. |
||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`, | ||
value: {[completedTaskReportAction.reportActionID]: completedTaskReportAction}, | ||
}, | ||
]; | ||
|
@@ -211,7 +203,7 @@ function completeTask(taskReportID, parentReportID, taskTitle) { | |
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`, | ||
value: {[completedTaskReportAction.reportActionID]: {pendingAction: null}}, | ||
}, | ||
]; | ||
|
@@ -229,11 +221,10 @@ function completeTask(taskReportID, parentReportID, taskTitle) { | |
/** | ||
* Reopens a closed task | ||
* @param {string} taskReportID ReportID of the task | ||
* @param {string} parentReportID ReportID of the linked parent report of the task so we can add the action | ||
* @param {string} taskTitle Title of the task | ||
*/ | ||
function reopenTask(taskReportID, parentReportID, taskTitle) { | ||
const message = `Reopened task: ${taskTitle}`; | ||
function reopenTask(taskReportID, taskTitle) { | ||
const message = `reopened task: ${taskTitle}`; | ||
const reopenedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, CONST.REPORT.ACTIONS.TYPE.TASKREOPENED, message); | ||
|
||
const optimisticData = [ | ||
|
@@ -243,20 +234,15 @@ function reopenTask(taskReportID, parentReportID, taskTitle) { | |
value: { | ||
stateNum: CONST.REPORT.STATE_NUM.OPEN, | ||
statusNum: CONST.REPORT.STATUS.OPEN, | ||
}, | ||
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`, | ||
value: { | ||
lastVisibleActionCreated: reopenedTaskReportAction.created, | ||
lastMessageText: message, | ||
lastActorEmail: reopenedTaskReportAction.actorEmail, | ||
lastReadTime: reopenedTaskReportAction.created, | ||
}, | ||
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`, | ||
value: {[reopenedTaskReportAction.reportActionID]: reopenedTaskReportAction}, | ||
}, | ||
]; | ||
|
@@ -273,7 +259,7 @@ function reopenTask(taskReportID, parentReportID, taskTitle) { | |
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`, | ||
value: {[reopenedTaskReportAction.reportActionID]: {pendingAction: null}}, | ||
}, | ||
]; | ||
|
@@ -526,13 +512,12 @@ function getShareDestination(reportID, reports, personalDetails) { | |
/** | ||
* Cancels a task by setting the report state to SUBMITTED and status to CLOSED | ||
* @param {string} taskReportID | ||
* @param {string} parentReportID | ||
* @param {string} taskTitle | ||
* @param {number} originalStateNum | ||
* @param {number} originalStatusNum | ||
*/ | ||
function cancelTask(taskReportID, parentReportID, taskTitle, originalStateNum, originalStatusNum) { | ||
const message = `Canceled task: ${taskTitle}`; | ||
function cancelTask(taskReportID, taskTitle, originalStateNum, originalStatusNum) { | ||
const message = `canceled task: ${taskTitle}`; | ||
const optimisticCancelReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, CONST.REPORT.ACTIONS.TYPE.TASKCANCELED, message); | ||
const optimisticReportActionID = optimisticCancelReportAction.reportActionID; | ||
|
||
|
@@ -547,7 +532,7 @@ function cancelTask(taskReportID, parentReportID, taskTitle, originalStateNum, o | |
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`, | ||
key: `${ONYXKEYS.COLLECTION.REPORT}${taskReportID}`, | ||
value: { | ||
lastVisibleActionCreated: optimisticCancelReportAction.created, | ||
lastMessageText: message, | ||
|
@@ -556,7 +541,7 @@ function cancelTask(taskReportID, parentReportID, taskTitle, originalStateNum, o | |
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`, | ||
value: { | ||
[optimisticReportActionID]: optimisticCancelReportAction, | ||
}, | ||
|
@@ -574,7 +559,7 @@ function cancelTask(taskReportID, parentReportID, taskTitle, originalStateNum, o | |
}, | ||
{ | ||
onyxMethod: Onyx.METHOD.MERGE, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, | ||
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${taskReportID}`, | ||
value: { | ||
[optimisticReportActionID]: null, | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#21924 (comment) issue happened using props.taskReport