captain-fact
captain-fact copied to clipboard
Notify everyone up on comment thread
Today, when replying to the reply of a comment, the comment's author doesn't get notified (only the direct replies do). The notification should go up the tree and notify everyone above.
Specs proposal
- [ ] Add a
threadcolumn onComments(string) - [ ] When creating a comment, the value for thread should be:
nilif it's a root comment#{reply_to.id}when it's a reply to a root comment#{reply_to.thread}-#{reply_to.id}for other replies Example:42-67-88
- [ ] In the migration, generate
threadfor all existing comments - [ ] When querying for the accounts to notify, look at the first
idfromthread(the root comment) and notify everyone
Storing the thread like that has multiple benefits:
- It allows us to review who should be notified in the future
- It gives an indication of the current depth of the comment (useful for https://github.com/CaptainFact/captain-fact/issues/38)
It has one major downside: it's a "soft" relation, meaning that if we delete/edit one of the root comments children won't be deleted.