From eb3eef4b80e201ba00ee3a05fccb81a6e9a8acac Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 9 Jul 2018 11:26:01 +0300 Subject: [PATCH] Fix notify settings saving (mute vs silent). Fixes #4855. --- .../SourceFiles/data/data_notify_settings.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/data/data_notify_settings.cpp b/Telegram/SourceFiles/data/data_notify_settings.cpp index ad5c19493..fe34be35f 100644 --- a/Telegram/SourceFiles/data/data_notify_settings.cpp +++ b/Telegram/SourceFiles/data/data_notify_settings.cpp @@ -73,15 +73,22 @@ bool NotifySettingsValue::change( const auto notMuted = muteForSeconds ? !(*muteForSeconds) : (!_mute || *_mute <= now); - return change(muteForSeconds + const auto newMute = muteForSeconds ? base::make_optional((*muteForSeconds > 0) ? (now + *muteForSeconds) : 0) - : base::none, (_sound && _sound->isEmpty() && notMuted) + : _mute; + const auto newSound = (_sound && _sound->isEmpty() && notMuted) ? qsl("default") - : _sound, _showPreviews, silentPosts + : _sound; + const auto newSilentPosts = silentPosts ? base::make_optional(*silentPosts) - : base::none); + : _silent; + return change( + newMute, + newSound, + _showPreviews, + newSilentPosts); } bool NotifySettingsValue::change(