Allow clearing history in megagroups.

This commit is contained in:
John Preston 2022-06-20 11:18:38 +04:00
parent 29c61635de
commit ff51bf81f3
3 changed files with 3 additions and 6 deletions

View file

@ -337,8 +337,6 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
lt_user,
{ user->firstName },
Ui::Text::RichLangValue);
} else if (_wipeHistoryJustClear) {
return std::nullopt;
} else {
result.checkbox.text = tr::lng_delete_for_everyone_check(tr::now);
}

View file

@ -641,8 +641,9 @@ void Histories::deleteAllMessages(
// }
}).send();
} else if (channel) {
using Flag = MTPchannels_DeleteHistory::Flag;
return session().api().request(MTPchannels_DeleteHistory(
MTP_flags(0),
MTP_flags(revoke ? Flag::f_for_everyone : Flag(0)),
channel->inputChannel,
MTP_int(deleteTillId)
)).done(finish).fail(finish).send();

View file

@ -903,9 +903,7 @@ bool PeerData::canRevokeFullHistory() const {
} else if (const auto chat = asChat()) {
return chat->amCreator();
} else if (const auto megagroup = asMegagroup()) {
return megagroup->amCreator()
&& megagroup->membersCountKnown()
&& megagroup->canDelete();
return megagroup->amCreator();
}
return false;
}