Skip to content

Commit 9b1460c

Browse files
fix(Task): allow task assignee to edit task after leaving group
1 parent 7323ec5 commit 9b1460c

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/libs/actions/Task.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ function canActionTask(taskReport: OnyxEntry<OnyxTypes.Report>, sessionAccountID
12661266
}
12671267

12681268
// When there is no parent report, exit early (this can also happen due to onyx key initialization)
1269-
if (!parentReport) {
1269+
if (!parentReport && !taskReport?.parentReportID) {
12701270
return false;
12711271
}
12721272

tests/actions/TaskTest.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ describe('actions/Task', () => {
112112
expect(canActionTask(taskReportCancelled)).toBe(false);
113113
});
114114

115+
it('returns false if parentReport is undefined and taskReport has no parentReportID', () => {
116+
const task = {
117+
...taskReport,
118+
parentReportID: undefined,
119+
};
120+
121+
expect(canActionTask(task, taskAssigneeAccountID, undefined, false)).toBe(false);
122+
});
123+
115124
it('returns false if the report is a cancelled task report', () => {
116125
// The accountID doesn't matter here because the code will do an early return for the cancelled report
117126
expect(canActionTask(taskReportCancelled, 0)).toBe(false);

0 commit comments

Comments
 (0)