Provided topic name to export controller for topic history.

This commit is contained in:
23rd
2025-11-25 06:07:19 +03:00
parent 57411b962f
commit 3ee0dcbacd
7 changed files with 28 additions and 12 deletions

View File

@@ -42,7 +42,8 @@ public:
QPointer<MTP::Instance> mtproto,
const MTPInputPeer &peer,
int32 topicRootId,
uint64 peerId);
uint64 peerId,
const QString &topicTitle);
rpl::producer<State> state() const;
@@ -149,6 +150,7 @@ private:
int32 _topicRootId = 0;
uint64 _topicPeerId = 0;
QString _topicTitle;
rpl::lifetime _lifetime;
@@ -183,11 +185,13 @@ ControllerObject::ControllerObject(
QPointer<MTP::Instance> mtproto,
const MTPInputPeer &peer,
int32 topicRootId,
uint64 peerId)
uint64 peerId,
const QString &topicTitle)
: _api(mtproto, weak.runner())
, _state(PasswordCheckState{})
, _topicRootId(topicRootId)
, _topicPeerId(peerId) {
, _topicPeerId(peerId)
, _topicTitle(topicTitle) {
_api.errors(
) | rpl::start_with_next([=](const MTP::Error &error) {
setState(ApiErrorState{ error });
@@ -760,7 +764,7 @@ int ControllerObject::substepsInStep(Step step) const {
void ControllerObject::exportTopic() {
auto topicInfo = Data::DialogInfo();
topicInfo.type = Data::DialogInfo::Type::PublicSupergroup;
topicInfo.name = "Topic";
topicInfo.name = _topicTitle.toUtf8();
topicInfo.peerId = PeerId(_topicPeerId);
topicInfo.relativePath = QString();
@@ -807,6 +811,7 @@ ProcessingState ControllerObject::stateTopic(
const DownloadProgress &progress) const {
return prepareState(Step::Topic, [&](ProcessingState &result) {
result.entityType = ProcessingState::EntityType::Topic;
result.entityName = _topicTitle;
result.entityIndex = 0;
result.entityCount = 1;
result.itemIndex = _messagesWritten + progress.itemIndex;
@@ -838,12 +843,14 @@ Controller::Controller(
QPointer<MTP::Instance> mtproto,
const MTPInputPeer &peer,
int32 topicRootId,
uint64 peerId)
uint64 peerId,
const QString &topicTitle)
: _wrapped(
std::move(mtproto),
peer,
static_cast<int32>(topicRootId),
static_cast<uint64>(peerId)) {
static_cast<uint64>(peerId),
topicTitle) {
}
rpl::producer<State> Controller::state() const {

View File

@@ -121,7 +121,8 @@ public:
QPointer<MTP::Instance> mtproto,
const MTPInputPeer &peer,
int32 topicRootId,
uint64 peerId);
uint64 peerId,
const QString &topicTitle);
rpl::producer<State> state() const;

View File

@@ -27,7 +27,8 @@ void Manager::start(not_null<PeerData*> peer) {
void Manager::startTopic(
not_null<PeerData*> peer,
MsgId topicRootId) {
MsgId topicRootId,
const QString &topicTitle) {
if (_panel) {
_panel->activatePanel();
return;
@@ -36,7 +37,8 @@ void Manager::startTopic(
&peer->session().mtp(),
peer->input,
int32(topicRootId.bare),
uint64(peer->id.value));
uint64(peer->id.value),
topicTitle);
setupPanel(&peer->session());
}

View File

@@ -36,7 +36,8 @@ public:
const MTPInputPeer &singlePeer = MTP_inputPeerEmpty());
void startTopic(
not_null<PeerData*> peer,
MsgId topicRootId);
MsgId topicRootId,
const QString &topicTitle);
[[nodiscard]] rpl::producer<View::PanelController*> currentView() const;
[[nodiscard]] bool inProgress() const;

View File

@@ -90,6 +90,7 @@ struct Settings {
int32 singleTopicRootId = 0;
uint64 singleTopicPeerId = 0;
QString singleTopicTitle;
TimeId availableAt = 0;

View File

@@ -142,7 +142,9 @@ Content ContentFromState(
pushMain(tr::lng_export_state_chats(tr::now));
push(
"topic",
u"Topic"_q,
state.entityName.isEmpty()
? tr::lng_deleted(tr::now)
: state.entityName,
(state.itemCount > 0
? (QString::number(state.itemIndex)
+ " / "

View File

@@ -1759,7 +1759,9 @@ void PeerMenuExportTopic(
not_null<PeerData*> peer,
MsgId topicRootId) {
base::call_delayed(st::defaultPopupMenu.showDuration, [=] {
Core::App().exportManager().startTopic(peer, topicRootId);
const auto topic = peer->forumTopicFor(topicRootId);
const auto topicTitle = topic ? topic->title() : QString();
Core::App().exportManager().startTopic(peer, topicRootId, topicTitle);
});
}