Fix local pinned hiding in topics.

This commit is contained in:
John Preston 2022-10-28 09:54:39 +04:00
parent 8dc27339b4
commit fcf9ca3982
2 changed files with 15 additions and 1 deletions

View file

@ -6235,6 +6235,7 @@ void HistoryWidget::checkPinnedBarState() {
}; };
auto destroyer = [this, object = std::move(qobject)]() mutable { auto destroyer = [this, object = std::move(qobject)]() mutable {
object = nullptr; object = nullptr;
_pinnedBarHeight = 0;
updateHistoryGeometry(); updateHistoryGeometry();
updateControlsGeometry(); updateControlsGeometry();
}; };

View file

@ -1505,6 +1505,18 @@ void RepliesWidget::setupPinnedTracker() {
return result.fullCount().has_value(); return result.fullCount().has_value();
}) | rpl::start_with_next([=](const SparseIdsSlice &result) { }) | rpl::start_with_next([=](const SparseIdsSlice &result) {
_topic->setHasPinnedMessages(*result.fullCount() != 0); _topic->setHasPinnedMessages(*result.fullCount() != 0);
if (result.skippedAfter() == 0) {
auto &settings = _history->session().settings();
const auto peerId = _history->peer->id;
const auto hiddenId = settings.hiddenPinnedMessageId(
peerId,
_rootId);
const auto last = result.size() ? result[result.size() - 1] : 0;
if (hiddenId && hiddenId != last) {
settings.setHiddenPinnedMessageId(peerId, _rootId, 0);
_history->session().saveSettingsDelayed();
}
}
checkPinnedBarState(); checkPinnedBarState();
}, _topicLifetime); }, _topicLifetime);
} }
@ -1521,7 +1533,7 @@ void RepliesWidget::checkPinnedBarState() {
_rootId); _rootId);
const auto currentPinnedId = Data::ResolveTopPinnedId(peer, _rootId); const auto currentPinnedId = Data::ResolveTopPinnedId(peer, _rootId);
const auto universalPinnedId = !currentPinnedId const auto universalPinnedId = !currentPinnedId
? int32(0) ? MsgId(0)
: currentPinnedId.msg; : currentPinnedId.msg;
if (universalPinnedId == hiddenId) { if (universalPinnedId == hiddenId) {
if (_pinnedBar) { if (_pinnedBar) {
@ -1531,6 +1543,7 @@ void RepliesWidget::checkPinnedBarState() {
}; };
auto destroyer = [this, object = std::move(qobject)]() mutable { auto destroyer = [this, object = std::move(qobject)]() mutable {
object = nullptr; object = nullptr;
_pinnedBarHeight = 0;
updateControlsGeometry(); updateControlsGeometry();
}; };
base::call_delayed( base::call_delayed(