| 1055 | } |
| 1056 | |
| 1057 | void Histories::sendCreateTopicRequest( |
| 1058 | not_null<History*> history, |
| 1059 | MsgId rootId) { |
| 1060 | const auto forum = history->asForum(); |
| 1061 | Assert(forum != nullptr); |
| 1062 | const auto topic = forum->topicFor(rootId); |
| 1063 | Assert(topic != nullptr); |
| 1064 | const auto randomId = base::RandomValue<uint64>(); |
| 1065 | session().data().registerMessageRandomId( |
| 1066 | randomId, |
| 1067 | { history->peer->id, rootId }); |
| 1068 | const auto api = &session().api(); |
| 1069 | using Flag = MTPmessages_CreateForumTopic::Flag; |
| 1070 | api->request(MTPmessages_CreateForumTopic( |
| 1071 | MTP_flags(Flag::f_icon_color |
| 1072 | | (topic->iconId() ? Flag::f_icon_emoji_id : Flag()) |
| 1073 | | (history->peer->isBot() ? Flag::f_title_missing : Flag())), |
| 1074 | history->peer->input(), |
| 1075 | MTP_string(topic->title()), |
| 1076 | MTP_int(topic->colorId()), |
| 1077 | MTP_long(topic->iconId()), |
| 1078 | MTP_long(randomId), |
| 1079 | MTPInputPeer() // send_as |
| 1080 | )).done([=](const MTPUpdates &result) { |
| 1081 | api->applyUpdates(result, randomId); |
| 1082 | }).fail([=](const MTP::Error &error) { |
| 1083 | api->sendMessageFail(error, history->peer, randomId); |
| 1084 | }).send(); |
| 1085 | } |
| 1086 | |
| 1087 | bool Histories::isCreatingTopic( |
| 1088 | not_null<History*> history, |
nothing calls this directly
no test coverage detected