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
ed6aa11b
Commit
ed6aa11b
authored
Jun 03, 2020
by
aleclofabbro
Browse files
Merge branch 'patch/filter_out_thread_with_empty_comments_edges' into develop
parents
deba50a8
ad89f303
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/HOC/pages/community/CommunityPage.tsx
View file @
ed6aa11b
...
...
@@ -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 @
ed6aa11b
...
...
@@ -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