captain-fact icon indicating copy to clipboard operation
captain-fact copied to clipboard

Notify everyone up on comment thread

Open Betree opened this issue 4 years ago • 1 comments

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.

Betree avatar Jul 09 '21 22:07 Betree

Specs proposal

  • [ ] Add a thread column on Comments (string)
  • [ ] When creating a comment, the value for thread should be:
    • nil if 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 thread for all existing comments
  • [ ] When querying for the accounts to notify, look at the first id from thread (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.

Betree avatar Sep 01 '21 13:09 Betree