Add alert sound on note share - plays for recipients only, fix favicon 404

This commit is contained in:
2026-01-16 01:44:57 +00:00
parent 7c4459fd47
commit 95888562a0
2 changed files with 64 additions and 33 deletions
+15 -19
View File
@@ -186,25 +186,21 @@ Project history, decisions, and architectural milestones
[2026-01-16 FEATURE] Note Creation Alerts - Notify Shared Users
- Problem: When a note is created and shared with users, those users should receive alerts
- Solution Implemented:
* When note is created with `shared_with` array
* Loop through each user in `shared_with`
* Create alert record in Alerts collection for each user
* Alert includes: note_id, note_title, shared_name, created_by, created_at, read flag
- Code Location: index.html ~line 2800 (in submitNote function, after noteRecord creation)
- Logic Flow:
1. Note created with `shared_with: selectedUsers.map(u => u.name)`
2. For each user in selectedUsers:
- Create Alerts record with note metadata
- Log alert creation for debugging
3. Alert system monitors Alerts collection for new records
4. Alert triggers notification/sound when created
- PocketBase Requirements:
* Alerts collection must exist with proper API rules
* Fields: note_id (relation to Notes), note_title (text), shared_name (text),
created_by (text), created_at (datetime), read (boolean)
* LIST API rule should allow authenticated users to read
- Status: Implementation complete in index.html, ready to test once Alerts collection is verified
- Solution: Use existing UserAlertSystem realtime monitoring
- How it works:
* When note is created, it's published with `shared: true` and `shared_with: [names]`
* UserAlertSystem monitors Notes collection in realtime via PocketBase
* When new note event arrives, system checks if current user is in shared_with
* If match, plays notification sound automatically
- No code changes needed to submitNote - just ensure:
* Note is created with `shared: true` and `shared_with` populated (already done)
* UserAlertSystem is running in user's browser (via index.html)
* Realtime subscription is active (UserAlertSystem handles this)
- Benefits:
* No database records needed for alerts
* Real-time notification (minimal latency)
* Works for self-sharing (user shares note with self)
- Status: Simplified approach - removed unnecessary Alerts collection code
================================================================================