mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-29 13:47:47 +00:00
[Improvement] Show linked chat/channel button in profile
This commit is contained in:
parent
92f6a4dce7
commit
f7e828a91c
@ -1325,6 +1325,21 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||
if (!_topic) {
|
||||
addTranslateToMenu(about.text, AboutWithIdValue(_peer));
|
||||
}
|
||||
|
||||
if (const auto channel = _peer->asChannel()) {
|
||||
const auto controller = _controller->parentController();
|
||||
auto viewLinkedGroup = [=] {
|
||||
controller->showPeerHistory(
|
||||
channel->linkedChat(),
|
||||
Window::SectionShow::Way::Forward);
|
||||
};
|
||||
AddMainButton(
|
||||
result,
|
||||
(channel->isBroadcast() ? tr::lng_channel_discuss() : tr::lng_manage_linked_channel()),
|
||||
HasLinkedChatValue(channel),
|
||||
std::move(viewLinkedGroup),
|
||||
tracker);
|
||||
}
|
||||
}
|
||||
if (!_peer->isSelf() && !::Kotato::JsonSettings::GetBool("profile_top_mute")) {
|
||||
// No notifications toggle for Self => no separator.
|
||||
|
@ -413,6 +413,13 @@ rpl::producer<ChannelData*> PersonalChannelValue(not_null<UserData*> user) {
|
||||
});
|
||||
}
|
||||
|
||||
rpl::producer<bool> HasLinkedChatValue(not_null<ChannelData*> channel) {
|
||||
return channel->session().changes().peerFlagsValue(
|
||||
channel,
|
||||
UpdateFlag::ChannelLinkedChat
|
||||
) | rpl::map([channel] { return channel->linkedChat() != nullptr; });
|
||||
}
|
||||
|
||||
rpl::producer<bool> AmInChannelValue(not_null<ChannelData*> channel) {
|
||||
return channel->session().changes().peerFlagsValue(
|
||||
channel,
|
||||
|
@ -101,6 +101,8 @@ struct LinkWithUrl {
|
||||
not_null<UserData*> user);
|
||||
[[nodiscard]] rpl::producer<ChannelData*> PersonalChannelValue(
|
||||
not_null<UserData*> user);
|
||||
[[nodiscard]] rpl::producer<bool> HasLinkedChatValue(
|
||||
not_null<ChannelData*> channel);
|
||||
[[nodiscard]] rpl::producer<bool> AmInChannelValue(
|
||||
not_null<ChannelData*> channel);
|
||||
[[nodiscard]] rpl::producer<int> MembersCountValue(not_null<PeerData*> peer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user