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

Revert "[CP Staging] Revert "[NO QA] Remove areChatRoomsEnabled checks"" #35576

Merged
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
5 changes: 1 addition & 4 deletions src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ type UnitRate = {rate: number};
* These are policies that we can use to create reports with in NewDot.
*/
function getActivePolicies(policies: OnyxCollection<Policy>): Policy[] | undefined {
return Object.values(policies ?? {}).filter<Policy>(
(policy): policy is Policy =>
policy !== null && policy && (policy.isPolicyExpenseChatEnabled || policy.areChatRoomsEnabled) && policy.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
);
return Object.values(policies ?? {}).filter<Policy>((policy): policy is Policy => policy !== null && policy && policy.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);
}

/**
Expand Down
3 changes: 0 additions & 3 deletions src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,6 @@ function createDraftInitialWorkspace(policyOwnerEmail = '', policyName = '', pol
isPolicyExpenseChatEnabled: true,
outputCurrency,
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
areChatRoomsEnabled: true,
customUnits,
makeMeAdmin,
},
Expand Down Expand Up @@ -1221,7 +1220,6 @@ function createWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policyName
isPolicyExpenseChatEnabled: true,
outputCurrency,
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
areChatRoomsEnabled: true,
customUnits,
},
},
Expand Down Expand Up @@ -1600,7 +1598,6 @@ function createWorkspaceFromIOUPayment(iouReport: Report): string | undefined {
// Setting the currency to USD as we can only add the VBBA for this policy currency right now
outputCurrency: CONST.CURRENCY.USD,
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
areChatRoomsEnabled: true,
customUnits,
};

Expand Down
1 change: 0 additions & 1 deletion src/libs/actions/TeachersUnite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ function addSchoolPrincipal(firstName: string, partnerUserID: string, lastName:
value: {
id: policyID,
isPolicyExpenseChatEnabled: true,
areChatRoomsEnabled: true,
type: CONST.POLICY.TYPE.CORPORATE,
name: policyName,
role: CONST.POLICY.ROLE.USER,
Expand Down
13 changes: 8 additions & 5 deletions src/pages/workspace/WorkspaceNewRoomPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,14 @@ function WorkspaceNewRoomPage(props) {

const workspaceOptions = useMemo(
() =>
_.map(PolicyUtils.getActivePolicies(props.policies), (policy) => ({
label: policy.name,
key: policy.id,
value: policy.id,
})),
_.map(
_.filter(PolicyUtils.getActivePolicies(props.policies), (policy) => policy.type !== CONST.POLICY.TYPE.PERSONAL),
(policy) => ({
label: policy.name,
key: policy.id,
value: policy.id,
}),
),
[props.policies],
);
const [policyID, setPolicyID] = useState(() => {
Expand Down
3 changes: 0 additions & 3 deletions src/types/onyx/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ type Policy = {
/** The custom units data for this policy */
customUnits?: Record<string, CustomUnit>;

/** Whether chat rooms can be created and used on this policy. Enabled manually by CQ/JS snippet. Always true for free policies. */
areChatRoomsEnabled: boolean;

/** Whether policy expense chats can be created and used on this policy. Enabled manually by CQ/JS snippet. Always true for free policies. */
isPolicyExpenseChatEnabled: boolean;

Expand Down
1 change: 0 additions & 1 deletion tests/utils/LHNTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ function getFakePolicy(id = 1, name = 'Workspace-Test-001') {
avatar: '',
employeeList: [],
isPolicyExpenseChatEnabled: true,
areChatRoomsEnabled: true,
lastModified: 1697323926777105,
autoReporting: true,
autoReportingFrequency: 'immediate',
Expand Down
1 change: 0 additions & 1 deletion tests/utils/collections/policies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default function createRandomPolicy(index: number): Policy {
id: index.toString(),
name: randWord(),
type: rand(Object.values(CONST.POLICY.TYPE)),
areChatRoomsEnabled: randBoolean(),
autoReporting: randBoolean(),
isPolicyExpenseChatEnabled: randBoolean(),
autoReportingFrequency: rand(Object.values(CONST.POLICY.AUTO_REPORTING_FREQUENCIES)),
Expand Down
Loading