From 138142f52d7cc6112a9f15b1cec0af79e02fbd46 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 10 Apr 2021 19:20:03 +0200 Subject: [PATCH] Add new setting --- src/api_data/notification_settings_api.rs | 4 +++- src/data/user.rs | 1 + src/helpers/user_helper.rs | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api_data/notification_settings_api.rs b/src/api_data/notification_settings_api.rs index d7ea2a7..e08e6bf 100644 --- a/src/api_data/notification_settings_api.rs +++ b/src/api_data/notification_settings_api.rs @@ -9,12 +9,14 @@ use crate::data::user::User; #[derive(Serialize)] pub struct NotificationSettingsAPI { allow_conversations: bool, + allow_notifications_sound: bool, } impl NotificationSettingsAPI { pub fn new(user: &User) -> Self { Self { - allow_conversations: user.allow_notif_conv + allow_conversations: user.allow_notif_conv, + allow_notifications_sound: user.allow_notif_sound, } } } \ No newline at end of file diff --git a/src/data/user.rs b/src/data/user.rs index 88ae849..352e7c5 100644 --- a/src/data/user.rs +++ b/src/data/user.rs @@ -132,6 +132,7 @@ pub struct User { /// Notifications settings pub allow_notif_conv: bool, + pub allow_notif_sound: bool, } impl User { diff --git a/src/helpers/user_helper.rs b/src/helpers/user_helper.rs index b759001..02a54d4 100644 --- a/src/helpers/user_helper.rs +++ b/src/helpers/user_helper.rs @@ -89,6 +89,7 @@ fn db_to_user(res: &database::RowResult) -> ResultBoxError { delete_likes_after: res.get_optional_positive_u64("delete_likes_after")?, // Conversation settings + allow_notif_sound: res.get_legacy_bool("allow_notif_sound")?, allow_notif_conv: res.get_legacy_bool("allow_notif_conv")?, }) }