Skip to content
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

Fix unavailable workspace display when creating a task #27645

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2593,11 +2593,12 @@ function buildOptimisticWorkspaceChats(policyID, policyName) {
* @param {String} parentReportID - Report ID of the chat where the Task is.
* @param {String} title - Task title.
* @param {String} description - Task description.
* @param {String | undefined} policyID - PolicyID of the parent report
*
* @returns {Object}
*/

function buildOptimisticTaskReport(ownerAccountID, assigneeAccountID = 0, parentReportID, title, description) {
function buildOptimisticTaskReport(ownerAccountID, assigneeAccountID = 0, parentReportID, title, description, policyID = undefined) {
return {
reportID: generateReportID(),
reportName: title,
Expand All @@ -2609,6 +2610,7 @@ function buildOptimisticTaskReport(ownerAccountID, assigneeAccountID = 0, parent
parentReportID,
stateNum: CONST.REPORT.STATE_NUM.OPEN,
statusNum: CONST.REPORT.STATUS.OPEN,
...(_.isUndefined(policyID) ? {} : {policyID}),
};
}

Expand Down
5 changes: 3 additions & 2 deletions src/libs/actions/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ function clearOutTaskInfo() {
* @param {String} assigneeEmail
* @param {Number} assigneeAccountID
* @param {Object} assigneeChatReport - The chat report between you and the assignee
* @param {String | undefined} policyID - the policyID of the parent report
*/
function createTaskAndNavigate(parentReportID, title, description, assigneeEmail, assigneeAccountID = 0, assigneeChatReport = null) {
const optimisticTaskReport = ReportUtils.buildOptimisticTaskReport(currentUserAccountID, assigneeAccountID, parentReportID, title, description);
function createTaskAndNavigate(parentReportID, title, description, assigneeEmail, assigneeAccountID = 0, assigneeChatReport = null, policyID = undefined) {
const optimisticTaskReport = ReportUtils.buildOptimisticTaskReport(currentUserAccountID, assigneeAccountID, parentReportID, title, description, policyID);

const assigneeChatReportID = assigneeChatReport ? assigneeChatReport.reportID : 0;
const taskReportID = optimisticTaskReport.reportID;
Expand Down
10 changes: 9 additions & 1 deletion src/pages/tasks/NewTaskPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,15 @@ function NewTaskPage(props) {
return;
}

Task.createTaskAndNavigate(parentReport.reportID, props.task.title, props.task.description, props.task.assignee, props.task.assigneeAccountID, props.task.assigneeChatReport);
Task.createTaskAndNavigate(
parentReport.reportID,
props.task.title,
props.task.description,
props.task.assignee,
props.task.assigneeAccountID,
props.task.assigneeChatReport,
parentReport.policyID,
);
}

if (!Permissions.canUseTasks(props.betas)) {
Expand Down
Loading