Xenon Pit #5

Boards now “exist”. It is possible to create a new board, and it will show up in the boards list. The next immediate issue is that Threads do not exist.

As in, if you try to click on the thread to reply or view – it 404’s.

When a user requests any thread (e.g. GET /myboard/res/910800.html) the query parameter 910800 would be used to identify an existing Post in that Board (rendered as an OPCell or “Original Post Cell”).

The posts in response to the OPCell are replies. This forms a Thread.

Each OPCell contains an embedded PostCell (TODO: Rename). The PostCell would be the server side render object for replies (posts) to the original post.

To put it another way – when viewing a specific thread, the render loop looks like this:

  • Board ID (from user GET request) [Board]
    • Thread ID (From user GET request) [Thread]
      • Original Post [OPCell]
        • Reply [PostCell]
        • Reply [PostCell]
        • Reply [PostCell]

If the user were to go “up one directory” so to speak, they would be on the Board view where all Threads can be seen (instead of just the single specified Thread). The render loop looks like:

  • Board ID (from the user GET request)
    • Thread ID
      • Original Post
        • Reply
        • Reply
        • Reply
    • Thread ID [Thread]
      • Original Post
        • Reply
    • Thread ID [Thread]
      • Original Post

The same template is reused in both scenarios, which means there is only one set of template code to maintain for both Board views and Thread views.

Next step is…. make it not 404 when you view a specific thread.

To do that requires:

  • Board objects in the database (done)
  • Post objects in the database (not done)
    • Ability to POST and have database object created (Post dbo)

n.b: technically Threads do not actually exist. Any Thread is just a regular Post with a “OP” flag set. At render time a database query is made to populate a virtual view of “OP” posts for any given board.

In rendering Threads (Original Posts and Reply Posts), there are database constraints – such that any Post in the database must either have the “OP” flag set as True, or it must declare the ID of a Post in which it is in reply to.

The Board ID is also significant. Any Post made belongs to a Board, and is under the purview of the User owner of that Board. Each Post increments the Board post counter by 1 and the sum total of posts in the Board then becomes the Post’s ID (e.g. If 999 posts have already been made and a new post is made, the ID of the new post will be 1000).

A Post’s Number can never be changed. If a post is deleted for any reason there will simply be a gap where the post was before. For example, Posts in a Thread would order 498,499,501,502,503 where post number 500 was deleted.

And just to be clear on timeline – I have already done all the hard work of file upload and asset creation in the database. This was completed some months ago in preparation for post creation (assets must be created before a post is made, which can result in orphaned assets – a story for another time).