-
Notifications
You must be signed in to change notification settings - Fork 143
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
Conversation
63f9829
to
6f3630a
Compare
core/notifications/src/primitives.rs
Outdated
@@ -120,6 +120,7 @@ pub enum UserNotificationCategory { | |||
AdminNotification, | |||
Marketing, | |||
Price, | |||
Onboarding, |
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.
This is not Onboarding - its security right?
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.
could fit in both categories
3a76453
to
33968fc
Compare
8a805ec
to
2ae3397
Compare
core/notifications/src/job/mod.rs
Outdated
) -> Result<(), JobError> { | ||
let data = data.into(); | ||
// TODO: I think reusing the id here might cause a bug | ||
match JobBuilder::new_with_id(LINK_EMAIL_REMINDER_ID, "link_email_reminder") |
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.
Since we are recursively calling back into this for pagination I think this may be a bug @thevaibhav-dixit @bodymindarts
2ae3397
to
28aa0ae
Compare
const ACCOUNT_LIVENESS_THRESHOLD_DAYS: i64 = 21; | ||
const ACCOUNT_AGED_THRESHOLD_DAYS: i64 = 21; | ||
const NOTIFICATION_COOL_OFF_THRESHOLD_DAYS: i64 = 90; |
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.
why not directly convert to duration here ?
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.
Agree
@@ -74,6 +74,7 @@ impl From<UserNotificationCategory> for proto::NotificationCategory { | |||
} | |||
UserNotificationCategory::Marketing => proto::NotificationCategory::Marketing, | |||
UserNotificationCategory::Price => proto::NotificationCategory::Price, | |||
_ => unimplemented!(), |
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.
Must remove
tx: &mut sqlx::Transaction<'_, sqlx::Postgres>, | ||
search_id: GaloyUserId, | ||
) -> Result<(Vec<GaloyUserId>, bool), EmailReminderProjectionError> { | ||
let last_transaction_at_threshold = Utc::now() |
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.
I would put math into SQL query
const ACCOUNT_AGED_THRESHOLD_DAYS: i64 = 21; | ||
const NOTIFICATION_COOL_OFF_THRESHOLD_DAYS: i64 = 90; | ||
|
||
pub fn new(pool: &PgPool) -> Self { |
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.
add constants as config.
1eb2d80
to
cf9b414
Compare
core/notifications/locales/en.yml
Outdated
@@ -60,3 +60,6 @@ transaction.paid_invoice.body_display_currency: "+%{displayCurrencyAmount} | %{f | |||
|
|||
price_changed.title: "Bitcoin is on the move!" | |||
price_changed.body: "Bitcoin is up %{percent_increase}% in the last day to %{price}!" | |||
|
|||
onboarding.link_email_reminder.title: "Link Email to Secure Account" |
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
6da7742
to
b13f801
Compare
No description provided.