-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(notifications): implement email reminder use case #4216
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6f3630a
chore(notifications): boilerplate for linking email use case
thevaibhav-dixit 28fbf83
chore(notifications): more boilerplate
thevaibhav-dixit 39c67d9
chore(notifications): support list_after_id in UserNotificationsSettings
bodymindarts 502c9d8
refactor(notifications): use GaloyUserId::search_begin()
bodymindarts b498e01
refactor(notifications): expose created_at for UserNotificationSettings
bodymindarts b7e7978
chore(notifications): add EmailReminderProjection
bodymindarts 33968fc
chore(notifications): remove user_transaction_tracker
thevaibhav-dixit 28aa0ae
feat(notifictions): link email reminders
UncleSamtoshi 74b8d98
refactor(notifications): re-use handle_single_user_event
bodymindarts ebeab2d
refactor(notifications): use kickoff_link_email_reminder to start rem…
bodymindarts a36d747
refactor(notifications): more efficient notification update
bodymindarts cf9b414
refactor(notifications): add email_reminder_projection config
thevaibhav-dixit 61756b1
chore(notifications): link email reminder under security category
thevaibhav-dixit b13f801
chore(notifications): use minutes in email reminder projection config
thevaibhav-dixit 342259f
chore(notifications): update schemas
thevaibhav-dixit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
core/notifications/src/notification_event/link_email_reminder.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use rust_i18n::t; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::{DeepLink, NotificationEvent}; | ||
use crate::{messages::*, primitives::*}; | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub struct LinkEmailReminder {} | ||
|
||
impl NotificationEvent for LinkEmailReminder { | ||
fn category(&self) -> UserNotificationCategory { | ||
UserNotificationCategory::Onboarding | ||
} | ||
|
||
fn deep_link(&self) -> Option<DeepLink> { | ||
None | ||
} | ||
|
||
fn to_localized_push_msg(&self, locale: GaloyLocale) -> LocalizedPushMessage { | ||
let title = t!( | ||
"onboarding.link_email_reminder.title", | ||
locale = locale.as_ref() | ||
) | ||
.to_string(); | ||
let body = t!( | ||
"onboarding.link_email_reminder.body", | ||
locale = locale.as_ref(), | ||
) | ||
.to_string(); | ||
LocalizedPushMessage { title, body } | ||
} | ||
|
||
fn to_localized_email(&self, _locale: GaloyLocale) -> Option<LocalizedEmail> { | ||
None | ||
} | ||
|
||
fn should_send_email(&self) -> bool { | ||
false | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn push_msg_correctly_formatted() { | ||
let event = LinkEmailReminder {}; | ||
let localized_message = event.to_localized_push_msg(GaloyLocale::from("en".to_string())); | ||
assert_eq!(localized_message.title, "Link Email to Secure Account"); | ||
assert_eq!( | ||
localized_message.body, | ||
"Link your email to secure your account and receive important updates" | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,7 @@ pub enum UserNotificationCategory { | |
AdminNotification, | ||
Marketing, | ||
Price, | ||
Onboarding, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not Onboarding - its security right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could fit in both categories |
||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: change this to security