Skip to content

Commit 1168901

Browse files
authored
Merge pull request Expensify#67910 from Expensify/revert-67338-fix/65479
[CP Staging] Revert "Fix/65479 - Leave option is not shown for IOU invite"
2 parents 13463ec + a481b75 commit 1168901

2 files changed

Lines changed: 0 additions & 78 deletions

File tree

src/libs/ReportUtils.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9818,10 +9818,6 @@ function canLeaveChat(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>, isRe
98189818
return true;
98199819
}
98209820

9821-
if (isMoneyRequestReport(report) && currentUserAccountID !== report?.managerID && currentUserAccountID !== report?.ownerAccountID && !isPolicyAdminPolicyUtils(policy)) {
9822-
return true;
9823-
}
9824-
98259821
if (isPublicRoom(report) && isAnonymousUserSession()) {
98269822
return false;
98279823
}

tests/unit/ReportUtilsTest.ts

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4550,80 +4550,6 @@ describe('ReportUtils', () => {
45504550

45514551
expect(canLeaveChat(report, reportPolicy)).toBe(true);
45524552
});
4553-
4554-
describe('when the report is a money report', () => {
4555-
it('should return false for the owner of the report', async () => {
4556-
const report: Report = {
4557-
...createRandomReport(1),
4558-
chatType: undefined,
4559-
type: CONST.REPORT.TYPE.IOU,
4560-
ownerAccountID: currentUserAccountID,
4561-
};
4562-
4563-
await Onyx.set(ONYXKEYS.SESSION, {email: currentUserEmail, accountID: currentUserAccountID});
4564-
4565-
const reportPolicy: Policy = {
4566-
...createRandomPolicy(1),
4567-
role: CONST.POLICY.ROLE.USER,
4568-
};
4569-
4570-
expect(canLeaveChat(report, reportPolicy)).toBe(false);
4571-
});
4572-
4573-
it('should return false for the manager of the report', async () => {
4574-
const report: Report = {
4575-
...createRandomReport(1),
4576-
chatType: undefined,
4577-
type: CONST.REPORT.TYPE.IOU,
4578-
managerID: currentUserAccountID,
4579-
};
4580-
4581-
await Onyx.set(ONYXKEYS.SESSION, {email: currentUserEmail, accountID: currentUserAccountID});
4582-
4583-
const reportPolicy: Policy = {
4584-
...createRandomPolicy(1),
4585-
role: CONST.POLICY.ROLE.USER,
4586-
};
4587-
4588-
expect(canLeaveChat(report, reportPolicy)).toBe(false);
4589-
});
4590-
4591-
it('should return false for the admin of the policy', async () => {
4592-
const report: Report = {
4593-
...createRandomReport(1),
4594-
chatType: CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT,
4595-
type: CONST.REPORT.TYPE.EXPENSE,
4596-
};
4597-
4598-
await Onyx.set(ONYXKEYS.SESSION, {email: currentUserEmail, accountID: currentUserAccountID});
4599-
4600-
const reportPolicy: Policy = {
4601-
...createRandomPolicy(1),
4602-
role: CONST.POLICY.ROLE.ADMIN,
4603-
};
4604-
4605-
expect(canLeaveChat(report, reportPolicy)).toBe(false);
4606-
});
4607-
4608-
it('should return true for the invited user', async () => {
4609-
const report: Report = {
4610-
...createRandomReport(1),
4611-
chatType: undefined,
4612-
type: CONST.REPORT.TYPE.IOU,
4613-
ownerAccountID: 1,
4614-
managerID: 2,
4615-
};
4616-
4617-
await Onyx.set(ONYXKEYS.SESSION, {email: currentUserEmail, accountID: currentUserAccountID});
4618-
4619-
const reportPolicy: Policy = {
4620-
...createRandomPolicy(1),
4621-
role: CONST.POLICY.ROLE.USER,
4622-
};
4623-
4624-
expect(canLeaveChat(report, reportPolicy)).toBe(true);
4625-
});
4626-
});
46274553
});
46284554

46294555
describe('canJoinChat', () => {

0 commit comments

Comments
 (0)