Auto-follow objects created by user
Summary
- Adds database triggers on propositions, documents, tags, and sources tables
- When a user creates any of these entity types, automatically adds them to the user's default follow list ("My Follows")
- Uses the existing
get_user_default_follow_list_id()helper function to find the user's default list - Gracefully handles edge cases (no default list exists, entry already exists)
Implementation Details
- Single generic trigger function
auto_follow_created_entity()that accepts entity type as parameter - Four triggers (
trg_auto_follow_proposition,trg_auto_follow_document,trg_auto_follow_tag,trg_auto_follow_source) calling the same function - Uses
ON CONFLICT DO NOTHINGto avoid errors if the entity is already followed
Test plan
- Verify migration applies successfully (CI/CD pipeline)
- Create a new proposition and verify it appears in the user's default follow list
- Create a new document and verify it appears in the user's default follow list
- Create a new tag and verify it appears in the user's default follow list
- Create a new source and verify it appears in the user's default follow list
Closes #133