Notifications
Time to make notifications great
General idea is that we have a bunch of different notification t
Time to make notifications great
General idea is that we have a bunch of different notification types, and depending on the notification type, the following fields are populated in specific ways:
- actor: The object that performed the activity. Typically a user
- verb: verb phrase that identifies the action of the activity
- target (optional): The object to which the activity was performed
- action_object (optional): the object linked to the action itself
## Creating Notifications
Because of the wide variety of notification types, creating notifications can be tricky
- Basically need a process to create notifications from straightforward parameters (e.g. create invite notification from only a GroupMember object)
- On creation, we should dispatch created event.
- For Socras, we use the serializer to handle this logic and validation for us.
- Serializer also allows us to easily track changes to object - but do we need to track changes and previous attributes of a notification?
- Only time we should be updating a notification is to mark read/seen, or to "delete" notification from notification list.
- Some notifications also need to disappear once action is taken (e.g. after invitee accepts or declines group invite, the notification should disappear).
Need a simple, deterministic way to create notifications.
Events might be the perfect way to do this.
For invited member
- admin/owner invites a member
- dispatches group.member.created event
- listener creates notification for invitee if status is REQUESTED
- WebSocket notifies client of new notification
Could have something like:
AppNotification.Factory.Group.Invited(**relevant args)
- return type would be an unsaved AppNotification, or a payload that could be used directly to create a notification
Would also be great if we could maintain notifications for different parts of the app, and store/dispatch them through a single interface. Potential notification categories:
- General
- Message
We could either add a field to AppNotification designating category (e.g. general, message, etc.), or filter by a different category field
- Type = specific type of notification
## Client
NotificationsContextProvider should provide context for notifications
- [x] store counts
**Notifications** are a key feature in technology that can significantly improve efficiency and productivity. It's time to focus on making them better.By Mike Morton