Open brendt opened 1 year ago
Let's use this issue first to brainstorm a bit about the idea, I don't wanna dive into it without having discussed it some more.
I have a question that I might have missed in your livestreams, @brendt. Can you help me understand the purpose of having a Message model or the entire concept of messages? I’m aware that it’s somewhat related to notifications, but I’m curious as to why we aren’t utilizing Laravel’s notifications for everything notification-related. We can store them in the database and display them under a /notifications route, enabling various types of in-app notifications like ArgumentCreated, RfcCreated, RfcClosed, NewComment, etc., each with distinct data and style.
I envision a system where users have a master setting for email notifications. They can enable it and choose the frequency—immediate, daily, or weekly. For immediate notifications, users receive emails as soon as notifications are sent. We can implement it like this:
public function via(object $notifiable): array
{
return $notifiable->email_frequency_setting === EmailNotificationSetting::Immediately
? ['mail', 'database']
: ['database'];
}
For daily notifications, we schedule a task to run every morning, collecting all unread notifications from the previous day for users who opted for this setting, packaging them in an attractive email format.
Weekly notifications follow a similar process, with a scheduled task running every Monday to aggregate the past week’s unread notifications for users who chose this option, sending them a digest email.
In-App Notifications Experience I’m inspired by GitHub’s notification system. By default, users are notified about new RFCs. Voting on an RFC means subscribing to it, with an option to unsubscribe available on the RFC page.
@brendt I updated my previous comment as it was unreadable (I need to work on my writing skills), I whish I had time to work on a POC related to this, but for now I'm quite busy at work.
Users should be able to configure if and how often they want to receive a digest mail of unread messages. I think it'll be a useful feature, because it'll allow us to use in-app messages for everything, and not worry about how and if we should notify users via email (or possible other channels in the future).
Possible options: