BobaBoard / issues

BobaBoard issue tracking
2 stars 0 forks source link

[Implementation Roadmap] Star Feed #74

Open essential-randomness opened 2 years ago

essential-randomness commented 2 years ago

Star Feed

We want users to be able to add threads to their Star Feed. After starring a thread, users can go to their Star Feed to see a list of their starred threads. The star feed also shows a notification whenever a starred thread is updated.

Side note: at some point, we'll likely have a "Bookmark Feed" that allows you to bookmark threads without getting a notification each time they update. More general "custom feeds" with various property settings and configurations are on the roadmap, but we aren't considering them at the moment to avoid over-engineering at a too early stage.

Backend Design

At the moment, this design only includes backend functionality. This is because Ms. Boba will implement the frontend, and she doesn't have time to write down unneeded details.

Functionality Breakdown

  1. User can add a thread to their Star Feed
  2. User can remove a thread from their Star Feed
  3. Users can fetch all the threads in their Star Feed, with pagination.
  4. Information on whether the thread is starred is returned with thread data.
  5. A notification is shown when a thread in the Star Feed updates
    • Q: Does the Star Feed notification also dim when you've visited the Star Feed after the latest update (but have not cleared all notifications)? Ms. Boba's take: Yes.
    • Q: Should we have a "clear all notifications for threads in the star feed" button? Ms. Boba's take: Likely, but not right now. Let's see how people use it.

Database Changes

A new table will need to be added to the Database. Since this is a built-in feeds (and since we're not going to over-engineer), we can skip making a Feeds table and simply make a user_starred_threads table. This should have the following columns:

  1. thread_id: the id of the starred thread.
  2. user_id: the id of the user that did the starring.

The same thread cannot be starred twice, so we should create a UNIQUE INDEX on the combination of these two columns.

New API endpoints

1. User can add a thread to their Star Feed

Endpoint: /threads/:thread_id/stars with POST method Return type: see e.g. "mute thread"

2. User can remove a thread from their Star Feed

Endpoint: /threads/:thread_id/stars with DELETE method Return type: see e.g. "mute thread"

3. Users can fetch all the threads in their Star Feed

Endpoint: /feeds/users/@me/stars with GET method Return type: FeedActivity (see /feeds/users/@me endpoint)

Note: all API endpoints require authentication.

Relevant documentation:

API endpoints updates

4. Information on whether the thread is starred is returned with thread data.

5. A notification is shown when a thread in the Star Feed updates

For this, we need to update the /users/@me/notifications endpoint. The response data type is defined directly in the JsonDoc. You might want it to be extracted to its own NotificationsResponse component in /types/open-api/notifications.yaml (again, I need to document this, so feel free to ask when you get here).

Changes:

Roadmap