Fix replying to stories with voice messages.

This commit is contained in:
John Preston 2023-05-30 09:44:31 +04:00
parent f814e401b9
commit b8cf00a0b2
3 changed files with 12 additions and 10 deletions

View file

@ -35,15 +35,7 @@ constexpr auto kReadRequestTimeout = 3 * crl::time(1000);
MTPInputReplyTo ReplyToForMTP( MTPInputReplyTo ReplyToForMTP(
not_null<Session*> owner, not_null<Session*> owner,
FullReplyTo replyTo) { FullReplyTo replyTo) {
if (replyTo.msgId || replyTo.topicRootId) { if (replyTo.storyId) {
using Flag = MTPDinputReplyToMessage::Flag;
return MTP_inputReplyToMessage(
(replyTo.topicRootId
? MTP_flags(Flag::f_top_msg_id)
: MTP_flags(0)),
MTP_int(replyTo.msgId ? replyTo.msgId : replyTo.topicRootId),
MTP_int(replyTo.topicRootId));
} else if (replyTo.storyId) {
if (const auto peer = owner->peerLoaded(replyTo.storyId.peer)) { if (const auto peer = owner->peerLoaded(replyTo.storyId.peer)) {
if (const auto user = peer->asUser()) { if (const auto user = peer->asUser()) {
return MTP_inputReplyToStory( return MTP_inputReplyToStory(
@ -51,6 +43,14 @@ MTPInputReplyTo ReplyToForMTP(
MTP_int(replyTo.storyId.story)); MTP_int(replyTo.storyId.story));
} }
} }
} else if (replyTo.msgId || replyTo.topicRootId) {
using Flag = MTPDinputReplyToMessage::Flag;
return MTP_inputReplyToMessage(
(replyTo.topicRootId
? MTP_flags(Flag::f_top_msg_id)
: MTP_flags(0)),
MTP_int(replyTo.msgId ? replyTo.msgId : replyTo.topicRootId),
MTP_int(replyTo.topicRootId));
} }
return MTPInputReplyTo(); return MTPInputReplyTo();
} }

View file

@ -2274,7 +2274,7 @@ void ComposeControls::initVoiceRecordBar() {
return std::nullopt; return std::nullopt;
}(); }();
if (error) { if (error) {
_show->showBox(Ui::MakeInformBox(*error)); _show->showToast(*error);
return true; return true;
} else if (_showSlowmodeError && _showSlowmodeError()) { } else if (_showSlowmodeError && _showSlowmodeError()) {
return true; return true;

View file

@ -421,6 +421,8 @@ void Controller::show(
} }
stories.loadAround(storyId); stories.loadAround(storyId);
list.user->updateFull();
if (_contentFaded) { if (_contentFaded) {
togglePaused(true); togglePaused(true);
} }