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

Support topic on-the-fly creation.

This commit is contained in:
John Preston
2022-10-04 19:34:45 +04:00
parent 065d2e2ac9
commit 3722e55b67
32 changed files with 447 additions and 130 deletions

View File

@@ -69,10 +69,10 @@ void ShareBotGame(
history,
replyTo,
randomId,
MTPmessages_SendMedia(
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(0),
chat->input,
MTP_int(0),
Data::Histories::ReplyToPlaceholder(),
MTP_inputMediaGame(
MTP_inputGameShortName(
bot->inputUser,

View File

@@ -139,7 +139,8 @@ void EditForumTopicBox(
const auto requestId = std::make_shared<mtpRequestId>();
const auto create = [=] {
if (!forum->peer->isForum()) {
const auto channel = forum->peer->asChannel();
if (!channel || !channel->isForum()) {
box->closeBox();
return;
} else if (title->getLastText().trimmed().isEmpty()) {
@@ -149,30 +150,10 @@ void EditForumTopicBox(
controller->showSection(
std::make_shared<HistoryView::RepliesMemento>(
forum,
forum->peer->forum()->reserveCreatingId(
channel->forum()->reserveCreatingId(
title->getLastText().trimmed(),
state->iconId)),
Window::SectionShow::Way::ClearStack);
#if 0 // #TODO forum create
const auto randomId = base::RandomValue<uint64>();
const auto api = &forum->session().api();
api->request(MTPchannels_CreateForumTopic(
MTP_flags(0),
forum->inputChannel,
MTP_string(title->getLastText().trimmed()),
MTPlong(), // icon_emoji_id
MTPInputMedia(),
MTP_string(message->getLastText().trimmed()),
MTP_long(randomId),
MTPVector<MTPMessageEntity>(),
MTPInputPeer() // send_as
)).done([=](const MTPUpdates &result) {
api->applyUpdates(result, randomId);
box->closeBox();
}).fail([=](const MTP::Error &error) {
api->sendMessageFail(error, forum, randomId);
}).send();
#endif
};
const auto save = [=] {