Skip to content

Commit

Permalink
Merge pull request #55809 from callstack-internal/feat/waterim-55104-…
Browse files Browse the repository at this point in the history
…members

[Internal QA]: Add possibility to assign cards from members page when feeds are configured
  • Loading branch information
mountiny authored Jan 30, 2025
2 parents c3b2f3a + 7327454 commit f0c49f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/libs/CardUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,9 @@ function checkIfNewFeedConnected(prevFeedsData: CompanyFeeds, currentFeedsData:
};
}

function getAllCardsForWorkspace(workspaceAccountID: number): CardList {
function getAllCardsForWorkspace(workspaceAccountID: number, allCardList: OnyxCollection<WorkspaceCardsList> = allWorkspaceCards): CardList {
const cards = {};
for (const [key, values] of Object.entries(allWorkspaceCards ?? {})) {
for (const [key, values] of Object.entries(allCardList ?? {})) {
if (key.includes(workspaceAccountID.toString()) && values) {
const {cardList, ...rest} = values;
Object.assign(cards, rest);
Expand Down
5 changes: 3 additions & 2 deletions src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
const StyleUtils = useStyleUtils();
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`);
const [cardList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}`);

const [isRemoveMemberConfirmModalVisible, setIsRemoveMemberConfirmModalVisible] = useState(false);
const [isRoleSelectionModalVisible, setIsRoleSelectionModalVisible] = useState(false);
Expand All @@ -81,7 +82,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
const policyOwnerDisplayName = formatPhoneNumber(getDisplayNameOrDefault(ownerDetails)) ?? policy?.owner ?? '';
const hasMultipleFeeds = Object.values(getCompanyFeeds(cardFeeds)).filter((feed) => !feed.pending).length > 0;

const workspaceCards = getAllCardsForWorkspace(workspaceAccountID);
const workspaceCards = getAllCardsForWorkspace(workspaceAccountID, cardList);
const hasWorkspaceCardsAssigned = !!workspaceCards && !!Object.values(workspaceCards).length;

useEffect(() => {
Expand Down Expand Up @@ -208,7 +209,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
return <NotFoundPage />;
}

const shouldShowCardsSection = hasWorkspaceCardsAssigned && (!!policy?.areExpensifyCardsEnabled || !!policy?.areCompanyCardsEnabled);
const shouldShowCardsSection = (hasWorkspaceCardsAssigned || !!cardFeeds) && (!!policy?.areExpensifyCardsEnabled || !!policy?.areCompanyCardsEnabled);

return (
<AccessOrNotFoundWrapper
Expand Down

0 comments on commit f0c49f7

Please sign in to comment.