Skip to content

Commit ae9c722

Browse files
author
Rajat Saxena
committed
Banner component fixed
1 parent 0376398 commit ae9c722

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed
31.1 KB
Loading

apps/docs/src/pages/en/users/permissions.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,6 @@ Let take a moment to understand what all permissions are available and what aspe
6464

6565
_Technical name: `media:manage`_
6666

67-
- **Post in community**
68-
69-
Create new posts in the community.
70-
71-
_Technical name: `community:post`_
72-
73-
- **Comment in community**
74-
75-
Comment on posts in the community.
76-
77-
_Technical name: `community:comment`_
78-
7967
- **Manage community**
8068

8169
Manage community posts, comments and settings.

apps/web/app/(with-contexts)/dashboard4/(sidebar)/community/[id]/manage/page.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ import { MembershipEntityType } from "@courselit/common-models/dist/constants";
7171
import { useCommunity } from "@components/hooks/useCommunity";
7272
import { Button } from "@components/ui/button";
7373
import { redirect, useRouter } from "next/navigation";
74+
import { useMembership } from "@components/hooks/use-membership";
7475
const { PaymentPlanType: paymentPlanType } = Constants;
7576

7677
export default function Page({
@@ -110,17 +111,28 @@ export default function Page({
110111
const [featuredImage, setFeaturedImage] = useState<Media | null>(null);
111112
const { toast } = useToast();
112113
const { community, error, loaded: communityLoaded } = useCommunity(id);
114+
const { membership, loaded: membershipLoaded } = useMembership(id);
113115
const [defaultPaymentPlan, setDefaultPaymentPlan] = useState("");
114116
const router = useRouter();
115117

116118
useEffect(() => {
117119
if (communityLoaded && community) {
118120
setCommunity(community);
119121
}
120-
if (communityLoaded && community === null) {
122+
}, [community, communityLoaded]);
123+
124+
useEffect(() => {
125+
if (
126+
communityLoaded &&
127+
membershipLoaded &&
128+
(community === null ||
129+
membership === null ||
130+
(membership &&
131+
membership.role !== Constants.MembershipRole.MODERATE))
132+
) {
121133
redirect(`/dashboard4/community/${id}`);
122134
}
123-
}, [community, communityLoaded]);
135+
}, [community, communityLoaded, membership, membershipLoaded]);
124136

125137
const fetcher = new FetchBuilder()
126138
.setUrl(`${address.backend}/api/graph`)

apps/web/graphql/pages/helpers.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ export async function getPageResponse(
2626
);
2727
if (course) {
2828
pageData = {
29-
...course,
3029
pageType: "product",
30+
title: course.title,
31+
cost: course.cost,
32+
costType: course.costType,
33+
type: course.type,
34+
tags: course.tags,
35+
featuredImage: course.featuredImage,
36+
courseId: course.courseId,
3137
};
3238
}
3339
break;
@@ -38,6 +44,7 @@ export async function getPageResponse(
3844
});
3945
if (community) {
4046
pageData = {
47+
pageType: "community",
4148
name: community.name,
4249
description: community.description,
4350
communityId: community.communityId,
@@ -52,8 +59,8 @@ export async function getPageResponse(
5259
name: p.name,
5360
planId: p.planId,
5461
})),
55-
pageType: "community",
5662
membersCount: community.membersCount,
63+
featuredImage: community.featuredImage,
5764
};
5865
}
5966
break;

0 commit comments

Comments
 (0)