Open KrishnaIyer opened 2 months ago
@nicholaspcr: Please let me know if the backend part makes sense?
@pierrephz: Can you think of a draft wireframes for the UX? Please ping me if you have doubts.
@nicholaspcr: Please let me know if the backend part makes sense?
Looks pretty good to me but I do have a question, would it be more efficient to have a NotificationsFilters
instead of NotificationsPreferences
? That way what we are storing on the user are only the notification types which have to be filtered.
Additionally I believe its easier for users to set what they don't want rather than the opposite.
Looks pretty good to me but I do have a question, would it be more efficient to have a NotificationsFilters instead of NotificationsPreferences? That way what we are storing on the user are only the notification types which have to be filtered.
The question here is the difference of what the default behavior is, a. Do users receive all emails by default and they choose what not to receive? (OR) b. Do users receive no emails by default and they can enable it for certain ones?
User experience-wise, (b) is better since all notifications are available in the Console by default.
@KrishnaIyer @nicholaspcr @pierrephz Considering that user_requested
and client_requested
require admin actions, they should be selected by default and the de-selection should be disabled in the UI. There should also be a message there saying that these require user action and that they are infrequent, so they cannot be opted out of. What do you think?
For the backend, I am not sure if it's best to ignore these or return an error. I would say error. In case one of these gets through, then it's nice to have some kind of feedback. Have them as "not allowed" options.
Considering that user_requested and client_requested require admin actions, they should be selected by default and the de-selection should be disabled in the UI.
I would say let's show it in a non-editable state in the console for admins only. For the API, I think we should just ignore this if it's set in the filters.
@KrishnaIyer In the notifyAdminsInternal()
method, can we just ignore the req.Email
field that will be deprecated and the allowed notification types as well? This method is only used for user_requested
and client_requested
types and these notifications should always send emails to admins, so we don't need to check if the user allows the notification types.
@KrishnaIyer In the notifyAdminsInternal() method, can we just ignore the req.Email field that will be deprecated and the allowed notification types as well? This method is only used for user_requested and client_requested types and these notifications should always send emails to admins, so we don't need to check if the user allows the notification types.
Yes I think that makes sense.
Email notification wireframe:
Email notification settings
in the side bar under User settings
We can still discuss the list of preferences, for example, I am not sure that Temporary password
should be an option there as you will always receive an email for that.
I am not sure the wireframe is correct. Do we need options for notifications like validate or login token? Also the descriptions don't seem correct as an API key can be changed for different entities and not only apps. @KrishnaIyer can you double check?
I have opened a draft PR with fixed descriptions and included only the necessary notifications - https://github.com/TheThingsNetwork/lorawan-stack/pull/7363
cc: @KrishnaIyer @pierrephz let me know if it's good
@ryaplots: These are just examples. You can adapt it to the list of options that we actually provide. If you need help in drafting text for each of the options, let me know.
Summary
Support user notification preferences. Replaces https://github.com/TheThingsIndustries/lorawan-stack/issues/3280
Current Situation
Currently users receive emails for all notification types except
collaborator_changed
. We want to allow users to choose what kind of emails they receive. All notifications are displayed in the console. So some users prefer to not receive emailsWhy do we need this? Who uses it, and when?
We want to allow users to choose what kind of emails they receive.
Proposed Implementation
Backend
Enum
forNotificationType
in the API. Currently we use hardcoded strings likeuser_requested
orcollaborator_changed
inpkg/email/templates
and when we use theCreateNotificationRequest
message.NotificationPreferences
message inside the User message.repeated NotificationType email_notification_types
. This is a list ofNotificationType
for which we would send emails.user_requested
andclient_requested
, both of which require admin actions. These emails are very infrequent and should not be skipped. So the API should either ignore these enums or return a validation error.emailReceiverIDs
argument. This is a filtered list of receiver IDs.req
is allowed for the user in their preferences.CreateNotification
, callis.SendNotificationEmailToUserIDs
onlyemailReceiverIDs
is not empty.email
field of the Notification message. We should instead get this from the user preferencesThe backend needs to target the
v3.33
branch since this requires a database migration.UX
/console/user-settings/profile
view and rename it toAccount
orPreferences
, whichever makes sense.NotificationType
enums.All
orNone
.Contributing
Validation
Code of Conduct