From dcb88a87c0c04e247ef5f771366df1ceb78bd00a Mon Sep 17 00:00:00 2001 From: Vaibhav Date: Thu, 15 Feb 2024 21:22:53 +0530 Subject: [PATCH] chore(notifications): remove Email from UserNotificationChannel --- core/notifications/proto/notifications.proto | 1 - core/notifications/src/email_executor/mod.rs | 5 +---- core/notifications/src/grpc/server/convert.rs | 1 - core/notifications/src/primitives.rs | 1 - 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/core/notifications/proto/notifications.proto b/core/notifications/proto/notifications.proto index ba37c1a1303..8298a7be4a1 100644 --- a/core/notifications/proto/notifications.proto +++ b/core/notifications/proto/notifications.proto @@ -19,7 +19,6 @@ service NotificationsService { enum NotificationChannel { PUSH = 0; - EMAIL = 1; } enum NotificationCategory { diff --git a/core/notifications/src/email_executor/mod.rs b/core/notifications/src/email_executor/mod.rs index dedd5afc290..e0993ad39d3 100644 --- a/core/notifications/src/email_executor/mod.rs +++ b/core/notifications/src/email_executor/mod.rs @@ -2,7 +2,7 @@ mod config; pub mod error; mod smtp; -use crate::{notification_event::*, primitives::*, user_notification_settings::*}; +use crate::{notification_event::*, user_notification_settings::*}; pub use config::*; use error::*; @@ -30,9 +30,6 @@ impl EmailExecutor { pub async fn notify(&self, event: &T) -> Result<(), EmailExecutorError> { let settings = self.settings.find_for_user_id(event.user_id()).await?; - if !settings.should_send_notification(UserNotificationChannel::Email, event.category()) { - return Ok(()); - } let msg = event.to_localized_msg(settings.locale().unwrap_or_default()); self.smtp.send_email(msg).await?; diff --git a/core/notifications/src/grpc/server/convert.rs b/core/notifications/src/grpc/server/convert.rs index ed37d0bfb0a..7c121af7a0b 100644 --- a/core/notifications/src/grpc/server/convert.rs +++ b/core/notifications/src/grpc/server/convert.rs @@ -20,7 +20,6 @@ impl From for UserNotificationChannel { fn from(channel: proto::NotificationChannel) -> Self { match channel { proto::NotificationChannel::Push => UserNotificationChannel::Push, - proto::NotificationChannel::Email => UserNotificationChannel::Email, } } } diff --git a/core/notifications/src/primitives.rs b/core/notifications/src/primitives.rs index 85cf98d6be1..db2cdda597f 100644 --- a/core/notifications/src/primitives.rs +++ b/core/notifications/src/primitives.rs @@ -84,7 +84,6 @@ impl std::fmt::Display for PushDeviceToken { #[graphql(name = "UserNotificationChannel")] pub enum UserNotificationChannel { Push, - Email, } #[derive(async_graphql::Enum, Debug, Hash, Copy, Clone, Eq, PartialEq, Deserialize, Serialize)]