mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Move message ownership to History.
This commit is contained in:
@@ -2424,7 +2424,8 @@ int ApiWrap::OnlineTillFromStatus(
|
||||
|
||||
void ApiWrap::clearHistory(not_null<PeerData*> peer, bool revoke) {
|
||||
auto deleteTillId = MsgId(0);
|
||||
if (const auto history = _session->data().historyLoaded(peer)) {
|
||||
const auto history = _session->data().historyLoaded(peer);
|
||||
if (history) {
|
||||
while (history->lastMessageKnown()) {
|
||||
const auto last = history->lastMessage();
|
||||
if (!last) {
|
||||
@@ -2446,7 +2447,6 @@ void ApiWrap::clearHistory(not_null<PeerData*> peer, bool revoke) {
|
||||
return;
|
||||
}
|
||||
deleteTillId = history->lastMessage()->id;
|
||||
history->clear(History::ClearType::ClearHistory);
|
||||
}
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
if (const auto migrated = peer->migrateFrom()) {
|
||||
@@ -2461,6 +2461,9 @@ void ApiWrap::clearHistory(not_null<PeerData*> peer, bool revoke) {
|
||||
} else {
|
||||
deleteHistory(peer, true, revoke);
|
||||
}
|
||||
if (history) {
|
||||
history->clear(History::ClearType::ClearHistory);
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::deleteConversation(not_null<PeerData*> peer, bool revoke) {
|
||||
|
Reference in New Issue
Block a user