Added support of draw-to-reply from shared media.

This commit is contained in:
23rd
2026-04-13 10:07:20 +03:00
parent de737b3cbe
commit 52615a3ccb
12 changed files with 236 additions and 41 deletions
@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_photo.h"
#include "data/data_chat.h"
#include "data/data_channel.h"
#include "data/data_chat_participant_status.h"
#include "data/data_peer_values.h"
#include "data/data_document.h"
#include "data/data_session.h"
@@ -620,7 +621,7 @@ void ListWidget::openPhoto(not_null<PhotoData*> photo, FullMsgId id) {
};
_controller->parentController()->openPhoto(
photo,
{ id, topicRootId(), monoforumPeerId() },
{ id, topicRootId(), monoforumPeerId(), showDrawButton() },
_controller->storiesPeer() ? &context : nullptr);
}
@@ -635,10 +636,21 @@ void ListWidget::openDocument(
_controller->parentController()->openDocument(
document,
showInMediaView,
{ id, topicRootId(), monoforumPeerId() },
{ id, topicRootId(), monoforumPeerId(), showDrawButton() },
_controller->storiesPeer() ? &context : nullptr);
}
bool ListWidget::showDrawButton() const {
if (const auto topic = _controller->key().topic()) {
return Data::CanSendAnyOf(topic, Data::FilesSendRestrictions());
} else if (const auto sublist = _controller->key().sublist()) {
return Data::CanSendAnyOf(sublist, Data::FilesSendRestrictions());
} else if (const auto peer = _controller->key().peer()) {
return Data::CanSendAnyOf(peer, Data::FilesSendRestrictions());
}
return false;
}
void ListWidget::trackSession(not_null<Main::Session*> session) {
if (_trackedSessions.contains(session)) {
return;
@@ -185,6 +185,7 @@ private:
rpl::lifetime &lifetime);
void setupSelectRestriction();
[[nodiscard]] bool showDrawButton() const;
[[nodiscard]] MsgId topicRootId() const;
[[nodiscard]] PeerId monoforumPeerId() const;