MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / applyTopicDeleted

Method applyTopicDeleted

Telegram/SourceFiles/data/data_forum.cpp:208–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208void Forum::applyTopicDeleted(MsgId rootId) {
209 _topicsDeleted.emplace(rootId);
210
211 const auto i = _topics.find(rootId);
212 if (i == end(_topics)) {
213 return;
214 }
215 const auto raw = i->second.get();
216 Core::App().notifications().clearFromTopic(raw);
217 owner().removeChatListEntry(raw);
218
219 if (ranges::contains(_lastTopics, not_null(raw))) {
220 reorderLastTopics();
221 }
222
223 if (_activeSubsectionTopic == raw) {
224 _activeSubsectionTopic = nullptr;
225 }
226 _topicDestroyed.fire(raw);
227 _history->session().recentPeers().chatOpenRemove(raw);
228 session().changes().topicUpdated(
229 raw,
230 Data::TopicUpdate::Flag::Destroyed);
231 session().changes().entryUpdated(
232 raw,
233 Data::EntryUpdate::Flag::Destroyed);
234 _topics.erase(i);
235
236 _history->destroyMessagesByTopic(rootId);
237 session().storage().unload(Storage::SharedMediaUnloadThread(
238 _history->peer->id,
239 rootId,
240 PeerId()));
241 _history->setForwardDraft(rootId, PeerId(), {});
242}
243
244void Forum::reorderLastTopics() {
245 // We want first kShowTopicNamesCount histories, by last message date.

Callers 1

PeerMenuDeleteTopicFunction · 0.80

Calls 15

AppClass · 0.85
PeerIdClass · 0.85
emplaceMethod · 0.80
removeChatListEntryMethod · 0.80
chatOpenRemoveMethod · 0.80
topicUpdatedMethod · 0.80
entryUpdatedMethod · 0.80
findMethod · 0.45
getMethod · 0.45
clearFromTopicMethod · 0.45

Tested by

no test coverage detected