2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Add ability to completely delete legacy group.

This commit is contained in:
John Preston
2021-01-21 08:20:29 +04:00
parent 19455d44db
commit 1774b21e88
4 changed files with 14 additions and 5 deletions

View File

@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "data/data_channel.h"
#include "data/data_chat.h"
#include "data/data_folder.h"
#include "data/data_scheduled_messages.h"
#include "main/main_session.h"
@@ -599,11 +600,17 @@ void Histories::deleteAllMessages(
)).done([=](const MTPBool &result) {
finish();
}).fail(fail).send();
} else if (revoke && peer->isChat() && peer->asChat()->amCreator()) {
return session().api().request(MTPmessages_DeleteChat(
peer->asChat()->inputChat
)).done([=](const MTPBool &result) {
finish();
}).fail(fail).send();
} else {
using Flag = MTPmessages_DeleteHistory::Flag;
const auto flags = Flag(0)
| (justClear ? Flag::f_just_clear : Flag(0))
| ((peer->isUser() && revoke) ? Flag::f_revoke : Flag(0));
| (revoke ? Flag::f_revoke : Flag(0));
return session().api().request(MTPmessages_DeleteHistory(
MTP_flags(flags),
peer->input,

View File

@@ -825,6 +825,8 @@ bool PeerData::canRevokeFullHistory() const {
&& (!user->isBot() || user->isSupport())
&& session().serverConfig().revokePrivateInbox
&& (session().serverConfig().revokePrivateTimeLimit == 0x7FFFFFFF);
} else if (const auto chat = asChat()) {
return chat->amCreator();
}
return false;
}