Skip to content

Commit

Permalink
WIP: Testing free community flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat Saxena committed Dec 23, 2024
1 parent 0b7454a commit a80080c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions apps/web/components/community/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function CommunityForum({
const [showDeleteConfirmation, setShowDeleteConfirmation] = useState(false);
const [comments, setComments] = useState<CommentType[]>([]);
const { community, loaded } = useCommunity(id);
const [refreshCommunityStatus, setRefreshCommunityStatus] = useState(0);

const loadTotalPosts = useCallback(async () => {
const query = `
Expand Down Expand Up @@ -145,13 +146,13 @@ export function CommunityForum({
try {
const response = await fetch.exec();
setMemberStatus(response.communityMembershipStatus);
setRefreshCommunityStatus((prev) => prev + 1);
} catch (err: any) {
toast({
title: "Error",
description: err.message,
});
} finally {
}
}
}, [address.backend, id, toast]);

const loadPosts = useCallback(async () => {
Expand Down Expand Up @@ -740,10 +741,11 @@ export function CommunityForum({
/>
) : (
<MembershipStatus
id={id}
id={id!}
status={memberStatus?.status}
rejectionReason={memberStatus?.rejectionReason}
joiningReasonText={community.joiningReasonText}
joiningReasonText={community?.joiningReasonText}
key={refreshCommunityStatus}
/>
)}

Expand Down
1 change: 0 additions & 1 deletion apps/web/components/community/membership-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default function MembershipStatus({
const { profile } = useContext(ProfileContext);

const handleJoinSubmit = async (e: FormEvent) => {
// Handle join request submission
e.preventDefault();
const query = `
mutation JoinCommunity(
Expand Down
2 changes: 2 additions & 0 deletions apps/web/models/Membership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const MembershipSchema = new mongoose.Schema<InternalMembership>(
default: MembershipStatus.PENDING,
},
paymentHistory: [MembershipPaymentSchema],
joiningReason: { type: String },
rejectionReason: { type: String },
},
{
timestamps: true,
Expand Down

0 comments on commit a80080c

Please sign in to comment.