Skip to content

Commit 0954525

Browse files
authored
Fix postgres invalid column for filter user_id spam errors (#358)
1 parent 92b0275 commit 0954525

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

hooks/useCourseController.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ export function useDiscussionThreadReadStatus(threadId: number) {
214214
}
215215
} else {
216216
// There is a Postgres trigger that creates a read status for every user for every thread. So, if we don't have one, we just haven't fetched it yet!
217+
if (!user?.id) {
218+
return;
219+
}
217220
const readStatus = await controller.discussionThreadReadStatus.getOneByFilters([
218221
{
219222
column: "discussion_thread_id",
@@ -223,7 +226,7 @@ export function useDiscussionThreadReadStatus(threadId: number) {
223226
{
224227
column: "user_id",
225228
operator: "eq",
226-
value: user?.id || ""
229+
value: user.id
227230
}
228231
]);
229232
if (readStatus) {
@@ -1204,7 +1207,7 @@ export function CourseControllerProvider({
12041207
}
12051208
}, [course_id, profile_id, role, userId]);
12061209

1207-
if (!courseController) {
1210+
if (!courseController || !userId) {
12081211
return (
12091212
<Box display="flex" justifyContent="center" alignItems="center" height="100vh">
12101213
<Spinner />

0 commit comments

Comments
 (0)