Do not copy show_preview notification setting to secret chats.
GitOrigin-RevId: 5c02532e5dbd26d1e5d8f9e9afee44ae33b65784
This commit is contained in:
parent
1c3503f834
commit
8b233484e0
@ -17817,7 +17817,7 @@ NotificationGroupId MessagesManager::get_dialog_notification_group_id(DialogId d
|
|||||||
} while (get_message_notification_group_force(next_notification_group_id).dialog_id.is_valid());
|
} while (get_message_notification_group_force(next_notification_group_id).dialog_id.is_valid());
|
||||||
group_info.group_id = next_notification_group_id;
|
group_info.group_id = next_notification_group_id;
|
||||||
group_info.is_changed = true;
|
group_info.is_changed = true;
|
||||||
VLOG(notifications) << "Assign " << next_notification_group_id << " to " << group_info.group_id << '/' << dialog_id;
|
VLOG(notifications) << "Assign " << next_notification_group_id << " to " << dialog_id;
|
||||||
on_dialog_updated(dialog_id, "get_dialog_notification_group_id");
|
on_dialog_updated(dialog_id, "get_dialog_notification_group_id");
|
||||||
|
|
||||||
notification_group_id_to_dialog_id_.emplace(next_notification_group_id, dialog_id);
|
notification_group_id_to_dialog_id_.emplace(next_notification_group_id, dialog_id);
|
||||||
@ -22570,7 +22570,11 @@ void MessagesManager::force_create_dialog(DialogId dialog_id, const char *source
|
|||||||
Dialog *user_d = get_dialog_force(DialogId(user_id));
|
Dialog *user_d = get_dialog_force(DialogId(user_id));
|
||||||
if (user_d != nullptr && user_d->notification_settings.is_synchronized) {
|
if (user_d != nullptr && user_d->notification_settings.is_synchronized) {
|
||||||
VLOG(notifications) << "Copy notification settings from " << user_d->dialog_id << " to " << dialog_id;
|
VLOG(notifications) << "Copy notification settings from " << user_d->dialog_id << " to " << dialog_id;
|
||||||
update_dialog_notification_settings(dialog_id, &d->notification_settings, user_d->notification_settings);
|
auto new_notification_settings = user_d->notification_settings;
|
||||||
|
new_notification_settings.use_default_show_preview = true;
|
||||||
|
new_notification_settings.show_preview = false;
|
||||||
|
new_notification_settings.is_secret_chat_show_preview_fixed = true;
|
||||||
|
update_dialog_notification_settings(dialog_id, &d->notification_settings, new_notification_settings);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG(ERROR) << "Found previously created secret " << d->dialog_id << ", when creating it from " << source;
|
LOG(ERROR) << "Found previously created secret " << d->dialog_id << ", when creating it from " << source;
|
||||||
@ -22679,6 +22683,14 @@ MessagesManager::Dialog *MessagesManager::add_new_dialog(unique_ptr<Dialog> &&d,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!d->notification_settings.is_secret_chat_show_preview_fixed &&
|
||||||
|
d->dialog_id.get_type() == DialogType::SecretChat) {
|
||||||
|
d->notification_settings.use_default_show_preview = true;
|
||||||
|
d->notification_settings.show_preview = false;
|
||||||
|
d->notification_settings.is_secret_chat_show_preview_fixed = true;
|
||||||
|
on_dialog_updated(d->dialog_id, "fix secret chat show preview");
|
||||||
|
}
|
||||||
|
|
||||||
d->have_full_history = true;
|
d->have_full_history = true;
|
||||||
d->need_restore_reply_markup = false;
|
d->need_restore_reply_markup = false;
|
||||||
d->is_last_read_inbox_message_id_inited = true;
|
d->is_last_read_inbox_message_id_inited = true;
|
||||||
|
@ -25,6 +25,7 @@ class DialogNotificationSettings {
|
|||||||
bool use_default_sound = true;
|
bool use_default_sound = true;
|
||||||
bool use_default_show_preview = true;
|
bool use_default_show_preview = true;
|
||||||
bool is_use_default_fixed = true;
|
bool is_use_default_fixed = true;
|
||||||
|
bool is_secret_chat_show_preview_fixed = false;
|
||||||
bool is_synchronized = false;
|
bool is_synchronized = false;
|
||||||
|
|
||||||
// local settings
|
// local settings
|
||||||
|
@ -32,6 +32,7 @@ void store(const DialogNotificationSettings ¬ification_settings, StorerT &sto
|
|||||||
STORE_FLAG(notification_settings.disable_pinned_message_notifications);
|
STORE_FLAG(notification_settings.disable_pinned_message_notifications);
|
||||||
STORE_FLAG(!notification_settings.use_default_disable_mention_notifications);
|
STORE_FLAG(!notification_settings.use_default_disable_mention_notifications);
|
||||||
STORE_FLAG(notification_settings.disable_mention_notifications);
|
STORE_FLAG(notification_settings.disable_mention_notifications);
|
||||||
|
STORE_FLAG(notification_settings.is_secret_chat_show_preview_fixed);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
if (is_muted) {
|
if (is_muted) {
|
||||||
store(notification_settings.mute_until, storer);
|
store(notification_settings.mute_until, storer);
|
||||||
@ -61,6 +62,7 @@ void parse(DialogNotificationSettings ¬ification_settings, ParserT &parser) {
|
|||||||
PARSE_FLAG(notification_settings.disable_pinned_message_notifications);
|
PARSE_FLAG(notification_settings.disable_pinned_message_notifications);
|
||||||
PARSE_FLAG(use_disable_mention_notifications);
|
PARSE_FLAG(use_disable_mention_notifications);
|
||||||
PARSE_FLAG(notification_settings.disable_mention_notifications);
|
PARSE_FLAG(notification_settings.disable_mention_notifications);
|
||||||
|
PARSE_FLAG(notification_settings.is_secret_chat_show_preview_fixed);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
notification_settings.use_default_disable_pinned_message_notifications = !use_disable_pinned_message_notifications;
|
notification_settings.use_default_disable_pinned_message_notifications = !use_disable_pinned_message_notifications;
|
||||||
notification_settings.use_default_disable_mention_notifications = !use_disable_mention_notifications;
|
notification_settings.use_default_disable_mention_notifications = !use_disable_mention_notifications;
|
||||||
|
Loading…
Reference in New Issue
Block a user