Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CU-86934hmxa] return root thread comments use pagination #238

Open
glacierck opened this issue Nov 15, 2023 · 3 comments
Open

[CU-86934hmxa] return root thread comments use pagination #238

glacierck opened this issue Nov 15, 2023 · 3 comments
Assignees
Labels
backlog enhancement New feature or request feature request Community feature request investigation Issue under investigation v4 Strapi v4

Comments

@glacierck
Copy link

The current flat structure returns no application value, it is like a journal. And the tree structure does not have pagination function and has no engineering significance

Each descendant comment should record their root comment ID, so that we can perform pagination queries on the root comment and recall the N levels of descendant comments below each root comment。

@cyp3rius
Copy link
Collaborator

Is it worth to introduce startWith property if undefined then its root, otherwise take the id of comment to build the nested structure starting with it?

@cyp3rius cyp3rius added enhancement New feature or request investigation Issue under investigation feature request Community feature request backlog v4 Strapi v4 labels Nov 15, 2023
@cyp3rius cyp3rius changed the title return root thread comments use pagination [CU-86934hmxa] return root thread comments use pagination Nov 15, 2023
@glacierck
Copy link
Author

The advantage of this is that it is easy to build a comment view with only two layers. The first layer is the root comment, which is oriented towards the comment object (article), and the second layer is the reply to the comment, with the reply target being the root comment or other reply.
Similar to the following view:

comment:

  • Tom: What is this article about?
    • Jack: I think it should be about love!
    • Robert > Jack: Hatred is more than love!
  • James: Great work!

@glacierck
Copy link
Author

glacierck commented Nov 15, 2023

To achieve such a view, we only need to maintain two relationships for comments: the root relationship and the reply relationship.
Of course, as root comments, they can be set null (when the reply target is a root comment, it is possible to only maintain the root relationship without filling in the reply relationship. In this case, they are the same)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog enhancement New feature or request feature request Community feature request investigation Issue under investigation v4 Strapi v4
Projects
None yet
Development

No branches or pull requests

3 participants