Do not allow to edit temporary notification by non-temporary.

GitOrigin-RevId: d4a6f577d70f80826f22169c3d6a07cf476bd0bf
This commit is contained in:
levlam 2019-06-17 18:59:35 +03:00
parent 2ec992b106
commit e3b9772cd2

View File

@ -1622,7 +1622,8 @@ void NotificationManager::edit_notification(NotificationGroupId group_id, Notifi
for (size_t i = 0; i < group.notifications.size(); i++) {
auto &notification = group.notifications[i];
if (notification.notification_id == notification_id) {
if (notification.type->get_message_id() != type->get_message_id()) {
if (notification.type->get_message_id() != type->get_message_id() ||
notification.type->is_temporary() != type->is_temporary()) {
LOG(ERROR) << "Ignore edit of " << notification_id << " with " << *type << ", because previous type is "
<< *notification.type;
return;
@ -1639,7 +1640,8 @@ void NotificationManager::edit_notification(NotificationGroupId group_id, Notifi
}
for (auto &notification : group.pending_notifications) {
if (notification.notification_id == notification_id) {
if (notification.type->get_message_id() != type->get_message_id()) {
if (notification.type->get_message_id() != type->get_message_id() ||
notification.type->is_temporary() != type->is_temporary()) {
LOG(ERROR) << "Ignore edit of " << notification_id << " with " << *type << ", because previous type is "
<< *notification.type;
return;