2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Respect topic pin limit from appConfig.

This commit is contained in:
John Preston
2022-12-01 21:44:32 +04:00
parent f0b8ccbd71
commit 34f0aae418
3 changed files with 14 additions and 4 deletions

View File

@@ -84,8 +84,6 @@ namespace {
using ViewElement = HistoryView::Element;
constexpr auto kTopicsPinLimit = 5;
// s: box 100x100
// m: box 320x320
// x: box 800x800
@@ -2049,7 +2047,8 @@ int Session::pinnedChatsLimit(FilterId filterId) const {
}
int Session::pinnedChatsLimit(not_null<Data::Forum*> forum) const {
return kTopicsPinLimit;
const auto limits = Data::PremiumLimits(_session);
return limits.topicsPinnedCurrent();
}
rpl::producer<int> Session::maxPinnedChatsLimitValue(
@@ -2084,7 +2083,12 @@ rpl::producer<int> Session::maxPinnedChatsLimitValue(
rpl::producer<int> Session::maxPinnedChatsLimitValue(
not_null<Data::Forum*> forum) const {
return rpl::single(pinnedChatsLimit(forum));
return rpl::single(rpl::empty_value()) | rpl::then(
_session->account().appConfig().refreshed()
) | rpl::map([=] {
const auto limits = Data::PremiumLimits(_session);
return limits.topicsPinnedCurrent();
});
}
const std::vector<Dialogs::Key> &Session::pinnedChatsOrder(