Skip to content

Commit

Permalink
disable join button in chat when space has automatic acceptance
Browse files Browse the repository at this point in the history
  • Loading branch information
andreymikhadyuk committed Aug 22, 2023
1 parent 9c91be2 commit 04bc6a0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
text-align: center;
cursor: pointer;
}
.permissionsTextDisabled {
color: var(--strong-gray);
cursor: not-allowed;
}

.messageInput {
width: 100%;
Expand Down
4 changes: 3 additions & 1 deletion src/pages/common/components/ChatComponent/ChatComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,9 @@ export default function ChatComponent({
>
{!isChatChannel && (!commonMember || !hasAccess || isHidden) ? (
<span
className={styles.permissionsText}
className={classNames(styles.permissionsText, {
[styles.permissionsTextDisabled]: !onJoinModalOpen,
})}
onClick={onJoinModalOpen}
>
{directParent ? "Join the space" : "Join the effort"}
Expand Down
15 changes: 12 additions & 3 deletions src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ import {
User,
} from "@/shared/models";
import { InfiniteScroll, TextEditorValue } from "@/shared/ui-kit";
import { addQueryParam, deleteQueryParam, getUserName } from "@/shared/utils";
import {
addQueryParam,
checkIsAutomaticJoin,
checkIsProject,
deleteQueryParam,
getUserName,
} from "@/shared/utils";
import { commonActions, selectRecentStreamId } from "@/store/states";
import { MIN_CHAT_WIDTH } from "../../constants";
import {
Expand Down Expand Up @@ -183,8 +189,11 @@ const FeedLayout: ForwardRefRenderFunction<FeedLayoutRef, FeedLayoutProps> = (
onOpen: onProjectJoinModalOpen,
onClose: onProjectJoinModalClose,
} = useAuthorizedModal();
const onJoinModalOpen = outerCommon?.directParent
? onProjectJoinModalOpen
const isAutomaticAcceptance = checkIsAutomaticJoin(outerGovernance);
const onJoinModalOpen = checkIsProject(outerCommon)
? isAutomaticAcceptance
? undefined
: onProjectJoinModalOpen
: onCommonJoinModalOpen;
const userForProfile = useUserForProfile();
const governance = outerGovernance || fetchedGovernance;
Expand Down

0 comments on commit 04bc6a0

Please sign in to comment.