-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
The posts/documents separation has got a bit messy (this is probably my fault for not fully understanding how they're intended to interact, and possibly for using the wrong APIs when listing posts in the UI).
As such there are some confusions:
- The "reply tree" handler builds a reply tree based on relationships between posts
- But some relationships are document<->document
- Editing a post creates a new document, which seems to break the ability to pull out relevant replies
I think our desired end state looks like this:
- Rename the
documentstable topost_revisions - Give the
posttable alatest_revision_id - Replies should store both the post ID and revision ID for the post/post_revision they are replying to
- Queries for UI display should only care about posts and relationships between posts
- When querying for a post, we should JOIN on the post_revisions table using the
latest_revision_id - Server APIs which currently refer to documents should instead refer to posts, e.g. we want to list all posts, view a post, edit a post, delete a post; where listing, viewing, or editing, always want to use the latest revision
- Revisions should not be editable or deleteable
- Creating a new revision should not break the reply trail for replies to the edited post
- Creating a new revision of a reply should not break the connection to the post it is a reply to
- All DB queries should have some tests showing that they return the correct data under various circumstances
- Same for server APIs
I think this means we'll need a new Rust type which is the union of a DB post and its most recent revision.
Once these changes are done, we can add support for the new types and API endpoints to the client.
Reactions are currently unavailable