Skip to content

Commit

Permalink
Merge pull request #2043 from daostack/bugfix/CW-2016-hide-membership…
Browse files Browse the repository at this point in the history
…-request-step

when join a 0 contribute common/space- payment details page opens #2016
  • Loading branch information
budnik9 authored Sep 7, 2023
2 parents ac0d7b2 + 4550c26 commit 3f74a4e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const INIT_DATA: IMembershipRequestData = {
interface IProps extends Pick<ModalProps, "isShowing" | "onClose"> {
common: Common;
governance: Governance;
shouldShowLoadingAfterSuccessfulCreation?: boolean;
showLoadingAfterSuccessfulCreation?: boolean;
onCreationStageReach?: (reached: boolean) => void;
onRequestCreated?: () => void;
}
Expand All @@ -69,7 +69,7 @@ export function MembershipRequestModal(props: IProps) {
onClose,
common,
governance,
shouldShowLoadingAfterSuccessfulCreation = false,
showLoadingAfterSuccessfulCreation = false,
onCreationStageReach,
onRequestCreated,
} = props;
Expand Down Expand Up @@ -189,7 +189,7 @@ export function MembershipRequestModal(props: IProps) {
/>
);
case MembershipRequestStage.Created:
return shouldShowLoadingAfterSuccessfulCreation ? (
return showLoadingAfterSuccessfulCreation && isAutomaticAcceptance ? (
<MembershipRequestCreating
userData={userData}
setUserData={setUserData}
Expand Down
5 changes: 1 addition & 4 deletions src/pages/common/providers/CommonData/CommonData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,8 @@ const CommonData: FC<CommonDataProps> = (props) => {
onClose={handleCommonJoinModalClose}
common={common}
governance={governance}
shouldShowLoadingAfterSuccessfulCreation={
governance.proposals[ProposalsTypes.MEMBER_ADMITTANCE]?.global
.votingDuration === 0
}
onRequestCreated={handleCommonJoinRequestCreated}
showLoadingAfterSuccessfulCreation
/>
<JoinProjectModal
isShowing={
Expand Down
7 changes: 7 additions & 0 deletions src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,12 @@ const FeedLayout: ForwardRefRenderFunction<FeedLayoutRef, FeedLayoutProps> = (
[getCommonPagePath, handleFeedItemClick],
);

useEffect(() => {
if (commonMember && isCommonJoinModalOpen) {
onCommonJoinModalClose();
}
}, [commonMember?.id]);

useEffect(() => {
if (!outerGovernance && selectedItemCommonData?.id) {
fetchGovernance(selectedItemCommonData.id);
Expand Down Expand Up @@ -805,6 +811,7 @@ const FeedLayout: ForwardRefRenderFunction<FeedLayoutRef, FeedLayoutProps> = (
onClose={onCommonJoinModalClose}
common={outerCommon}
governance={governance}
showLoadingAfterSuccessfulCreation
/>
<JoinProjectModal
isShowing={isProjectJoinModalOpen}
Expand Down

0 comments on commit 3f74a4e

Please sign in to comment.