this post was submitted on 03 Jul 2023
1 points (100.0% liked)

Lemmy Support

4641 readers
29 users here now

Support / questions about Lemmy.

Matrix Space: #lemmy-space

founded 5 years ago
MODERATORS
 

I can fetch the comments for a post using the API using:

comment/list?post_id=

and that works fine but I have a question about how to determine what comment is a reply to another/ determining the comment nesting/threading.

From what I can tell the only thing tying any two comments together is the comment.path prop.

Is that correct?

That prop seems to be in a format where each nested comment has the root parent path number followed by . then their unique number. And each subsequent comment is another number sequence after that and so on.

Example:

root comment:

{ 
     "comment": {
          "path": 12345
     }
}

child comment 1:

{ 
     "comment": {
          "path": 12345.327928
     }
}

Is this correct?

Can someone who has used this API explain how this works? There are no doc comments in the docs for the http client so I'm just winging it here.

top 2 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 0 points 1 year ago (1 children)

There is a community for developers over at https://lemm.ee/c/lemmydev - might want to visit that server directly given how out of sync Lemmy.ml can be.

yes, basically the path variable is how you organize repy branches. Name your language, there is likely some open source code on how to output a tree

[โ€“] [email protected] 1 points 1 year ago

Awesome. Didn't even know about that community. I'll take my woes over there.

Thanks!