@grishka i'm not sure what the code does, but storing the parent post for each comment seems totally normal, we are doing the same thing. though @dessalines wants to change that, apparently there is support in postgres for storing tree relations directly or something like that (but quite complicated).
@felix @dessalines that's nice. I use MySQL and it's pretty barebones. Anyway, here's how I get all replies (and replies to those, as far as they go) for an arbitrary comment:
https://github.com/grishka/Smithereen/blob/master/src/main/java/smithereen/storage/PostStorage.java#L415
Here's its usage: https://github.com/grishka/Smithereen/blob/master/src/main/java/smithereen/routes/PostRoutes.java#L276
I take the reply key of the parent post/comment and append its ID to it.
And here's how it looks in the database.
I'm curious as to why you send the entire reply chain in each comment. To solve the case when a comment in the middle of a thread is deleted?
@felix @dessalines that's nice. I use MySQL and it's pretty barebones. Anyway, here's how I get all replies (and replies to those, as far as they go) for an arbitrary comment:
https://github.com/grishka/Smithereen/blob/master/src/main/java/smithereen/storage/PostStorage.java#L415
Here's its usage: https://github.com/grishka/Smithereen/blob/master/src/main/java/smithereen/routes/PostRoutes.java#L276
I take the reply key of the parent post/comment and append its ID to it.