Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodlenet
MoodleNet Frontend
Commits
ad89f303
Commit
ad89f303
authored
Jun 03, 2020
by
aleclofabbro
Browse files
filter out threads with empty comments edges on CommunityPage discussion tab. warns when found.
parent
deba50a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/HOC/pages/community/CommunityPage.tsx
View file @
ad89f303
...
...
@@ -75,11 +75,19 @@ export const CommunityPage: FC<CommunityPage> = ({ communityId, basePath }) => {
const
ThreadsBox
=
(
<>
{
threadsPage
.
edges
.
map
(
thread
=>
(
<
Box
key
=
{
thread
.
id
}
>
<
ThreadPreviewHOC
threadId
=
{
thread
.
id
}
/>
</
Box
>
))
}
{
threadsPage
.
edges
.
map
(
thread
=>
thread
.
comments
?.
edges
[
0
]
?
(
<
Box
key
=
{
thread
.
id
}
>
<
ThreadPreviewHOC
threadId
=
{
thread
.
id
}
/>
</
Box
>
)
:
(
(
console
.
warn
(
`Found a thread [id:
${
thread
.
id
}
] with an empty comments edges .. skipping`
,
thread
),
null
)
)
)
}
</>
);
...
...
src/fe/thread/preview/useThreadPreview.ts
View file @
ad89f303
...
...
@@ -19,7 +19,7 @@ export const useThreadPreview = (threadId: Thread['id']) => {
const
{
reply
}
=
useReplyComment
(
thread
?.
comments
?.
edges
[
0
],
community
?.
id
,
thread
?.
comments
?.
edges
[
0
].
creator
?.
userName
thread
?.
comments
?.
edges
[
0
]
?
.
creator
?.
userName
);
return
useMemo
(()
=>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment