Improved the bug on the teachers
This commit is contained in:
@@ -121,7 +121,7 @@ export default function TeacherDashboard({user}: Props) {
|
||||
};
|
||||
|
||||
const GroupsList = () => {
|
||||
const filter = (x: Group) => x.admin === user.id || x.participants.includes(user.id);
|
||||
const filter = (x: Group) => x.admin === user.id;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -212,6 +212,12 @@ export default function GroupList({user}: {user: User}) {
|
||||
userType: user?.type,
|
||||
});
|
||||
|
||||
const {groups: corporateGroups} = useGroups({
|
||||
admin: user && filterTypes.includes(user?.type) ? user.id : undefined,
|
||||
userType: user?.type,
|
||||
adminAdmins: user?.id,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (user && ["corporate", "teacher", "mastercorporate"].includes(user.type)) {
|
||||
setFilterByUser(true);
|
||||
@@ -309,7 +315,8 @@ export default function GroupList({user}: {user: User}) {
|
||||
groups
|
||||
.filter((g) => g.admin === user.id)
|
||||
.flatMap((g) => g.participants)
|
||||
.includes(u.id) || groups.flatMap((g) => g.participants).includes(u.id),
|
||||
.includes(u.id) ||
|
||||
(user?.type === "teacher" ? corporateGroups : groups).flatMap((g) => g.participants).includes(u.id),
|
||||
)
|
||||
: users
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user