1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-29 08:46:27 +00:00

Add new setting

This commit is contained in:
Pierre HUBERT 2021-04-10 19:20:03 +02:00
parent e725d24104
commit 138142f52d
3 changed files with 5 additions and 1 deletions

View File

@ -9,12 +9,14 @@ use crate::data::user::User;
#[derive(Serialize)] #[derive(Serialize)]
pub struct NotificationSettingsAPI { pub struct NotificationSettingsAPI {
allow_conversations: bool, allow_conversations: bool,
allow_notifications_sound: bool,
} }
impl NotificationSettingsAPI { impl NotificationSettingsAPI {
pub fn new(user: &User) -> Self { pub fn new(user: &User) -> Self {
Self { Self {
allow_conversations: user.allow_notif_conv allow_conversations: user.allow_notif_conv,
allow_notifications_sound: user.allow_notif_sound,
} }
} }
} }

View File

@ -132,6 +132,7 @@ pub struct User {
/// Notifications settings /// Notifications settings
pub allow_notif_conv: bool, pub allow_notif_conv: bool,
pub allow_notif_sound: bool,
} }
impl User { impl User {

View File

@ -89,6 +89,7 @@ fn db_to_user(res: &database::RowResult) -> ResultBoxError<User> {
delete_likes_after: res.get_optional_positive_u64("delete_likes_after")?, delete_likes_after: res.get_optional_positive_u64("delete_likes_after")?,
// Conversation settings // Conversation settings
allow_notif_sound: res.get_legacy_bool("allow_notif_sound")?,
allow_notif_conv: res.get_legacy_bool("allow_notif_conv")?, allow_notif_conv: res.get_legacy_bool("allow_notif_conv")?,
}) })
} }