mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Fix join requests list for legacy groups.
This commit is contained in:
parent
b347308137
commit
b1e2a4243e
3 changed files with 21 additions and 31 deletions
|
@ -171,7 +171,7 @@ std::shared_ptr<ContentMemento> Memento::DefaultContent(
|
|||
return std::make_shared<SimilarChannels::Memento>(
|
||||
peer->asChannel());
|
||||
case Section::Type::RequestsList:
|
||||
return std::make_shared<RequestsList::Memento>(peer->asChannel());
|
||||
return std::make_shared<RequestsList::Memento>(peer);
|
||||
case Section::Type::PeerGifts:
|
||||
return std::make_shared<PeerGifts::Memento>(peer->asUser());
|
||||
case Section::Type::SavedSublists:
|
||||
|
|
|
@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "info/requests_list/info_requests_list_widget.h"
|
||||
|
||||
#include "boxes/peers/edit_peer_requests_box.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "info/info_controller.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
#include "ui/search_field_controller.h"
|
||||
|
@ -28,10 +27,10 @@ public:
|
|||
InnerWidget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller,
|
||||
not_null<ChannelData*> channel);
|
||||
not_null<PeerData*> peer);
|
||||
|
||||
[[nodiscard]] not_null<ChannelData*> channel() const {
|
||||
return _channel;
|
||||
[[nodiscard]] not_null<PeerData*> peer() const {
|
||||
return _peer;
|
||||
}
|
||||
|
||||
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
||||
|
@ -67,7 +66,7 @@ private:
|
|||
|
||||
const std::shared_ptr<Main::SessionShow> _show;
|
||||
not_null<Controller*> _controller;
|
||||
const not_null<ChannelData*> _channel;
|
||||
const not_null<PeerData*> _peer;
|
||||
std::unique_ptr<RequestsBoxController> _listController;
|
||||
object_ptr<ListWidget> _list;
|
||||
|
||||
|
@ -77,14 +76,14 @@ private:
|
|||
InnerWidget::InnerWidget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller,
|
||||
not_null<ChannelData*> channel)
|
||||
not_null<PeerData*> peer)
|
||||
: RpWidget(parent)
|
||||
, _show(controller->uiShow())
|
||||
, _controller(controller)
|
||||
, _channel(channel)
|
||||
, _peer(peer)
|
||||
, _listController(std::make_unique<RequestsBoxController>(
|
||||
controller,
|
||||
_channel))
|
||||
_peer))
|
||||
, _list(setupList(this, _listController.get())) {
|
||||
setContent(_list.data());
|
||||
_listController->setDelegate(static_cast<PeerListDelegate*>(this));
|
||||
|
@ -188,23 +187,19 @@ std::shared_ptr<Main::SessionShow> InnerWidget::peerListUiShow() {
|
|||
return _show;
|
||||
}
|
||||
|
||||
Memento::Memento(not_null<ChannelData*> channel)
|
||||
: ContentMemento(channel, nullptr, PeerId()) {
|
||||
Memento::Memento(not_null<PeerData*> peer)
|
||||
: ContentMemento(peer, nullptr, PeerId()) {
|
||||
}
|
||||
|
||||
Section Memento::section() const {
|
||||
return Section(Section::Type::RequestsList);
|
||||
}
|
||||
|
||||
not_null<ChannelData*> Memento::channel() const {
|
||||
return peer()->asChannel();
|
||||
}
|
||||
|
||||
object_ptr<ContentWidget> Memento::createWidget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller,
|
||||
const QRect &geometry) {
|
||||
auto result = object_ptr<Widget>(parent, controller, channel());
|
||||
auto result = object_ptr<Widget>(parent, controller, peer());
|
||||
result->setInternalState(geometry, this);
|
||||
return result;
|
||||
}
|
||||
|
@ -222,21 +217,18 @@ Memento::~Memento() = default;
|
|||
Widget::Widget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller,
|
||||
not_null<ChannelData*> channel)
|
||||
not_null<PeerData*> peer)
|
||||
: ContentWidget(parent, controller) {
|
||||
controller->setSearchEnabledByContent(true);
|
||||
_inner = setInnerWidget(object_ptr<InnerWidget>(
|
||||
this,
|
||||
controller,
|
||||
channel));
|
||||
_inner = setInnerWidget(object_ptr<InnerWidget>(this, controller, peer));
|
||||
}
|
||||
|
||||
rpl::producer<QString> Widget::title() {
|
||||
return tr::lng_manage_peer_requests();
|
||||
}
|
||||
|
||||
not_null<ChannelData*> Widget::channel() const {
|
||||
return _inner->channel();
|
||||
not_null<PeerData*> Widget::peer() const {
|
||||
return _inner->peer();
|
||||
}
|
||||
|
||||
bool Widget::showInternal(not_null<ContentMemento*> memento) {
|
||||
|
@ -244,7 +236,7 @@ bool Widget::showInternal(not_null<ContentMemento*> memento) {
|
|||
return false;
|
||||
}
|
||||
if (auto requestsMemento = dynamic_cast<Memento*>(memento.get())) {
|
||||
if (requestsMemento->channel() == channel()) {
|
||||
if (requestsMemento->peer() == peer()) {
|
||||
restoreState(requestsMemento);
|
||||
return true;
|
||||
}
|
||||
|
@ -261,7 +253,7 @@ void Widget::setInternalState(
|
|||
}
|
||||
|
||||
std::shared_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_shared<Memento>(channel());
|
||||
auto result = std::make_shared<Memento>(peer());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "info/info_content_widget.h"
|
||||
|
||||
class ChannelData;
|
||||
class PeerData;
|
||||
struct PeerListState;
|
||||
|
||||
namespace Info::RequestsList {
|
||||
|
@ -18,7 +18,7 @@ class InnerWidget;
|
|||
|
||||
class Memento final : public ContentMemento {
|
||||
public:
|
||||
explicit Memento(not_null<ChannelData*> channel);
|
||||
explicit Memento(not_null<PeerData*> peer);
|
||||
|
||||
object_ptr<ContentWidget> createWidget(
|
||||
QWidget *parent,
|
||||
|
@ -27,8 +27,6 @@ public:
|
|||
|
||||
Section section() const override;
|
||||
|
||||
[[nodiscard]] not_null<ChannelData*> channel() const;
|
||||
|
||||
void setListState(std::unique_ptr<PeerListState> state);
|
||||
std::unique_ptr<PeerListState> listState();
|
||||
|
||||
|
@ -44,9 +42,9 @@ public:
|
|||
Widget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller,
|
||||
not_null<ChannelData*> channel);
|
||||
not_null<PeerData*> peer);
|
||||
|
||||
[[nodiscard]] not_null<ChannelData*> channel() const;
|
||||
[[nodiscard]] not_null<PeerData*> peer() const;
|
||||
|
||||
bool showInternal(
|
||||
not_null<ContentMemento*> memento) override;
|
||||
|
|
Loading…
Add table
Reference in a new issue