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

Update policy type definitions and use areChatRoomsEnabled flag #26982

Merged
merged 6 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion src/libs/PolicyUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import ONYXKEYS from '../ONYXKEYS';

/**
* Filter out the active policies, which will exclude policies with pending deletion
* These are policies that we can use to create reports with in NewDot.
* @param {Object} policies
* @returns {Array}
*/
function getActivePolicies(policies) {
return _.filter(policies, (policy) => policy && policy.isPolicyExpenseChatEnabled && policy.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);
return _.filter(policies, (policy) => policy && (policy.isPolicyExpenseChatEnabled || policy.areChatRoomsEnabled) && policy.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
16 changes: 10 additions & 6 deletions src/types/onyx/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ import * as OnyxCommon from './OnyxCommon';

type Policy = {
/** The ID of the policy */
id?: string;
id: string;

/** The name of the policy */
name?: string;
name: string;

/** The current user's role in the policy */
role?: ValueOf<typeof CONST.POLICY.ROLE>;
role: ValueOf<typeof CONST.POLICY.ROLE>;

/** The policy type */
type?: ValueOf<typeof CONST.POLICY.TYPE>;
type: ValueOf<typeof CONST.POLICY.TYPE>;

/** The email of the policy owner */
owner?: string;
owner: string;

/** The output currency for the policy */
outputCurrency?: string;
outputCurrency: string;

/** The URL for the policy avatar */
avatar?: string;
Expand All @@ -32,6 +32,10 @@ type Policy = {
isFromFullPolicy?: boolean;
lastModified?: string;
customUnits?: Record<string, unknown>;

areChatRoomsEnabled: boolean;

isPolicyExpenseChatEnabled: boolean;
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
};

export default Policy;
Loading