diff --git a/Telegram/Resources/animations/discussion.tgs b/Telegram/Resources/animations/discussion.tgs
new file mode 100644
index 000000000..b513b9457
Binary files /dev/null and b/Telegram/Resources/animations/discussion.tgs differ
diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings
index f8e7033d4..efb3b7334 100644
--- a/Telegram/Resources/langs/lang.strings
+++ b/Telegram/Resources/langs/lang.strings
@@ -1332,8 +1332,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_manage_discussion_group_add" = "Add a group";
"lng_manage_linked_channel" = "Linked channel";
"lng_manage_linked_channel_restore" = "Restore linked channel";
-"lng_manage_discussion_group_about" = "Select a group chat for discussion that will be displayed in your channel.";
-"lng_manage_discussion_group_about_chosen" = "A link to {group} is shown to all subscribers in the bottom panel.";
+"lng_manage_discussion_group_about" = "Select a group chat that will host comments from your channel.";
+"lng_manage_discussion_group_about_chosen" = "{group} is selected as the group that hosts comments for your channel.";
"lng_manage_discussion_group_create" = "Create a new group";
"lng_manage_discussion_group_unlink" = "Unlink group";
"lng_manage_discussion_group_posted" = "Everything you post in the channel is forwarded to this group.";
diff --git a/Telegram/Resources/qrc/telegram/animations.qrc b/Telegram/Resources/qrc/telegram/animations.qrc
index 5fcb2dd18..06a600c00 100644
--- a/Telegram/Resources/qrc/telegram/animations.qrc
+++ b/Telegram/Resources/qrc/telegram/animations.qrc
@@ -9,5 +9,6 @@
../../animations/cloud_password/hint.tgs
../../animations/cloud_password/email.tgs
../../animations/ttl.tgs
+ ../../animations/discussion.tgs
diff --git a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp
index 7f4484c47..31eb7336d 100644
--- a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp
+++ b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.cpp
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_keys.h"
#include "data/data_channel.h"
#include "data/data_chat.h"
+#include "settings/settings_common.h"
#include "data/data_changes.h"
#include "ui/widgets/labels.h"
#include "ui/widgets/buttons.h"
@@ -25,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_info.h"
+#include "styles/style_settings.h"
namespace {
@@ -208,47 +210,24 @@ void Controller::choose(not_null chat) {
Ui::LayerOption::KeepOther);
}
-object_ptr SetupAbout(
- not_null parent,
+[[nodiscard]] rpl::producer About(
not_null channel,
ChannelData *chat) {
- auto about = object_ptr(
- parent,
- QString(),
- st::linkedChatAbout);
- about->setMarkedText([&] {
- if (!channel->isBroadcast()) {
- return tr::lng_manage_linked_channel_about(
- tr::now,
- lt_channel,
- Ui::Text::Bold(chat->name()),
- Ui::Text::WithEntities);
- } else if (chat != nullptr) {
- return tr::lng_manage_discussion_group_about_chosen(
- tr::now,
- lt_group,
- Ui::Text::Bold(chat->name()),
- Ui::Text::WithEntities);
- }
- return tr::lng_manage_discussion_group_about(
- tr::now,
+ if (!channel->isBroadcast()) {
+ return tr::lng_manage_linked_channel_about(
+ lt_channel,
+ rpl::single(Ui::Text::Bold(chat->name())),
Ui::Text::WithEntities);
- }());
- return about;
+ } else if (chat != nullptr) {
+ return tr::lng_manage_discussion_group_about_chosen(
+ lt_group,
+ rpl::single(Ui::Text::Bold(chat->name())),
+ Ui::Text::WithEntities);
+ }
+ return tr::lng_manage_discussion_group_about(Ui::Text::WithEntities);
}
-object_ptr SetupFooter(
- not_null parent,
- not_null channel) {
- return object_ptr(
- parent,
- (channel->isBroadcast()
- ? tr::lng_manage_discussion_group_posted
- : tr::lng_manage_linked_channel_posted)(),
- st::linkedChatAbout);
-}
-
-object_ptr SetupCreateGroup(
+[[nodiscard]] object_ptr SetupCreateGroup(
not_null parent,
not_null navigation,
not_null channel,
@@ -273,23 +252,7 @@ object_ptr SetupCreateGroup(
return result;
}
-object_ptr SetupUnlink(
- not_null parent,
- not_null channel,
- Fn callback) {
- auto result = object_ptr(
- parent,
- (channel->isBroadcast()
- ? tr::lng_manage_discussion_group_unlink
- : tr::lng_manage_linked_channel_unlink)() | Ui::Text::ToUpper(),
- st::infoUnlinkChatButton);
- result->addClickHandler([=] {
- callback(nullptr);
- });
- return result;
-}
-
-object_ptr EditLinkedChatBox(
+[[nodiscard]] object_ptr EditLinkedChatBox(
not_null navigation,
not_null channel,
ChannelData *chat,
@@ -298,27 +261,61 @@ object_ptr EditLinkedChatBox(
Fn callback) {
Expects((channel->isBroadcast() && canEdit) || (chat != nullptr));
- const auto init = [=](not_null box) {
+ class ListBox final : public PeerListBox {
+ public:
+ ListBox(
+ QWidget *parent,
+ std::unique_ptr controller,
+ Fn)> init)
+ : PeerListBox(
+ parent,
+ std::move(controller),
+ [=](not_null) { init(this); }) {
+ }
+
+ void showFinished() override {
+ _showFinished.fire({});
+ }
+
+ rpl::producer<> showFinishes() const {
+ return _showFinished.events();
+ }
+
+ private:
+ rpl::event_stream<> _showFinished;
+
+ };
+
+ const auto init = [=](not_null box) {
auto above = object_ptr(box);
- above->add(
- SetupAbout(above, channel, chat),
- st::linkedChatAboutPadding);
+ Settings::AddDividerTextWithLottie(
+ above,
+ box->showFinishes(),
+ About(channel, chat),
+ u"discussion"_q);
if (!chat) {
- above->add(SetupCreateGroup(
- above,
- navigation,
- channel,
- callback));
+ above->add(
+ SetupCreateGroup(above, navigation, channel, callback));
}
box->peerListSetAboveWidget(std::move(above));
auto below = object_ptr(box);
if (chat && canEdit) {
- below->add(SetupUnlink(below, channel, callback));
+ Settings::AddButton(
+ below,
+ (channel->isBroadcast()
+ ? tr::lng_manage_discussion_group_unlink
+ : tr::lng_manage_linked_channel_unlink)(),
+ st::infoUnlinkChatButton,
+ { &st::settingsIconMinus, Settings::kIconRed }
+ )->addClickHandler([=] { callback(nullptr); });
+ Settings::AddSkip(below);
}
- below->add(
- SetupFooter(below, channel),
- st::linkedChatAboutPadding);
+ Settings::AddDividerText(
+ below,
+ (channel->isBroadcast()
+ ? tr::lng_manage_discussion_group_posted
+ : tr::lng_manage_linked_channel_posted)());
box->peerListSetBelowWidget(std::move(below));
box->setTitle(channel->isBroadcast()
@@ -339,7 +336,7 @@ object_ptr EditLinkedChatBox(
std::move(chats),
std::move(callback),
std::move(showHistoryCallback));
- return Box(std::move(controller), init);
+ return Box(std::move(controller), init);
}
} // namespace
diff --git a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.h b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.h
index ce7c50703..788f57757 100644
--- a/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.h
+++ b/Telegram/SourceFiles/boxes/peers/edit_linked_chat_box.h
@@ -17,14 +17,14 @@ namespace Window {
class SessionNavigation;
} // namespace Window
-object_ptr EditLinkedChatBox(
+[[nodiscard]] object_ptr EditLinkedChatBox(
not_null navigation,
not_null channel,
not_null chat,
bool canEdit,
Fn callback);
-object_ptr EditLinkedChatBox(
+[[nodiscard]] object_ptr EditLinkedChatBox(
not_null navigation,
not_null channel,
std::vector> &&chats,