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
User can add a thread to their Star Feed
User can remove a thread from their Star Feed
Users can fetch all the threads in their Star Feed, with pagination.
Information on whether the thread is starred is returned with thread data.
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:
thread_id: the id of the starred thread.
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)
4. Information on whether the thread is starred is returned with thread data.
Anything that returns a data type of ThreadSummary or Thread will need to be updated.
Add a starred (type: boolean) property to ThreadSummary (in /types/open-api/thread.yaml)
Very much feel free to ask questions about this/point out sources of confusion cause it needs heavy documenting.
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:
(Optional) Extract NotificationsResponse.
Rename BoardNotifications OpenAPI data type to ActivityNotifications (of FeedNotifications).
Add a feeds property as a map from feed id to ActivityNotifications (the feed id of the Star Feed will be fixed, and likely a simple "starred").
Roadmap
[ ] User can add a thread to their Star Feed
[ ] User can remove a thread from their Star Feed
[ ] Users can fetch all the threads in their Star Feed, with pagination.
[ ] Information on whether the thread is starred is returned with thread data.
[ ] A notification is shown when a thread in the Star Feed updates
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.
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
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 auser_starred_threads
table. This should have the following columns: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
withPOST
method Return type: see e.g. "mute thread"2. User can remove a thread from their Star Feed
Endpoint:
/threads/:thread_id/stars
withDELETE
method Return type: see e.g. "mute thread"3. Users can fetch all the threads in their Star Feed
Endpoint:
/feeds/users/@me/stars
withGET
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.
ThreadSummary
orThread
will need to be updated.starred
(type: boolean
) property toThreadSummary
(in/types/open-api/thread.yaml
)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 ownNotificationsResponse
component in/types/open-api/notifications.yaml
(again, I need to document this, so feel free to ask when you get here).Changes:
NotificationsResponse
.BoardNotifications
OpenAPI data type toActivityNotifications
(ofFeedNotifications
).feeds
property as a map fromfeed id
toActivityNotifications
(thefeed id
of the Star Feed will be fixed, and likely a simple "starred").Roadmap