2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Allow supergroup members to clear history.

This commit is contained in:
John Preston
2017-11-21 20:38:17 +04:00
parent 75d8d01b17
commit 2387b66e86
12 changed files with 105 additions and 53 deletions

View File

@@ -1215,19 +1215,6 @@ void MainWidget::deleteAllFromUserPart(DeleteAllFromUserParams params, const MTP
}
}
void MainWidget::clearHistory(PeerData *peer) {
if (History *h = App::historyLoaded(peer->id)) {
if (h->lastMsg) {
Local::addSavedPeer(h->peer, h->lastMsg->date);
}
h->clear();
h->newLoaded = h->oldLoaded = true;
}
auto flags = MTPmessages_DeleteHistory::Flag::f_just_clear;
DeleteHistoryRequest request = { peer, true };
MTP::send(MTPmessages_DeleteHistory(MTP_flags(flags), peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, request));
}
void MainWidget::addParticipants(PeerData *chatOrChannel, const std::vector<not_null<UserData*>> &users) {
if (chatOrChannel->isChat()) {
auto chat = chatOrChannel->asChat();