2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Support cloud view_as_messages forum setting.

This commit is contained in:
John Preston
2023-11-16 20:53:06 +04:00
parent 43a8733fc7
commit 0ffda016da
10 changed files with 102 additions and 9 deletions

View File

@@ -4545,6 +4545,25 @@ void Session::applyStatsDcId(
}
}
void Session::saveViewAsMessages(
not_null<Forum*> forum,
bool viewAsMessages) {
const auto channel = forum->channel();
if (const auto requestId = _viewAsMessagesRequests.take(channel)) {
_session->api().request(*requestId).cancel();
}
_viewAsMessagesRequests[channel] = _session->api().request(
MTPchannels_ToggleViewForumAsMessages(
channel->inputChannel,
MTP_bool(viewAsMessages))
).done([=] {
_viewAsMessagesRequests.remove(channel);
}).fail([=] {
_viewAsMessagesRequests.remove(channel);
}).send();
channel->setViewAsMessagesFlag(viewAsMessages);
}
void Session::webViewResultSent(WebViewResultSent &&sent) {
return _webViewResultSent.fire(std::move(sent));
}