Email or username:

Password:

Forgot your password?
4 comments
Gregory

@felix ah yes it is. I also present comments as a tree and I wanted to be able to select a subtree from any level, so I did a very cursed thing with "reply keys": github.com/grishka/Smithereen/ It's an array of all parent post IDs serialized as int32s that I store in a database column. There's an index on it and I can select all posts with a certain prefix using LIKE BINARY.

felix

@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).

Gregory

@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:
github.com/grishka/Smithereen/

Here's its usage: github.com/grishka/Smithereen/
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:
github.com/grishka/Smithereen/

Here's its usage: github.com/grishka/Smithereen/
I take the reply key of the parent post/comment and append its ID to it.

felix

@grishka @dessalines seeing that code formatting makes me really happy that Rust has auto-formatting :p

We dont send the entire reply chain, only the ID of the parent post and the immediate parent comment, if it exists. Further parent comments are fetched one by one after that.

Go Up