Treat empty notification sound as "default".

GitOrigin-RevId: bc32890cf3365dc3c46ed93724022efd631ba602
This commit is contained in:
levlam 2019-02-01 15:16:00 +03:00
parent f465b460ca
commit 563a88fde4

View File

@ -121,12 +121,16 @@ DialogNotificationSettings get_dialog_notification_settings(tl_object_ptr<telegr
bool use_default_sound = (settings->flags_ & telegram_api::peerNotifySettings::SOUND_MASK) == 0;
bool use_default_show_preview = (settings->flags_ & telegram_api::peerNotifySettings::SHOW_PREVIEWS_MASK) == 0;
auto mute_until = use_default_mute_until || settings->mute_until_ <= G()->unix_time() ? 0 : settings->mute_until_;
auto sound = std::move(settings->sound_);
if (sound.empty()) {
sound = "default";
}
bool silent_send_message =
(settings->flags_ & telegram_api::peerNotifySettings::SILENT_MASK) == 0 ? false : settings->silent_;
return {use_default_mute_until,
mute_until,
use_default_sound,
std::move(settings->sound_),
std::move(sound),
use_default_show_preview,
settings->show_previews_,
silent_send_message,
@ -143,8 +147,10 @@ ScopeNotificationSettings get_scope_notification_settings(tl_object_ptr<telegram
settings->mute_until_ <= G()->unix_time()
? 0
: settings->mute_until_;
auto sound =
(settings->flags_ & telegram_api::peerNotifySettings::SOUND_MASK) == 0 ? "default" : std::move(settings->sound_);
auto sound = std::move(settings->sound_);
if (sound.empty()) {
sound = "default";
}
auto show_preview =
(settings->flags_ & telegram_api::peerNotifySettings::SHOW_PREVIEWS_MASK) == 0 ? false : settings->show_previews_;
return {mute_until, std::move(sound), show_preview, old_disable_pinned_message_notifications,