| 371 | } |
| 372 | |
| 373 | void Controller::setupTopicViewer() { |
| 374 | session().data().itemIdChanged( |
| 375 | ) | rpl::on_next([=](const Data::Session::IdChange &change) { |
| 376 | if (const auto topic = _key.topic()) { |
| 377 | if (topic->rootId() == change.oldId |
| 378 | || (topic->peer()->id == change.newId.peer |
| 379 | && topic->rootId() == change.newId.msg)) { |
| 380 | const auto now = topic->forum()->topicFor(change.newId.msg); |
| 381 | _key = Key(now); |
| 382 | replaceWith(std::make_shared<Memento>(now, _section)); |
| 383 | } |
| 384 | } |
| 385 | }, _lifetime); |
| 386 | } |
| 387 | |
| 388 | Wrap Controller::wrap() const { |
| 389 | return _widget->wrap(); |