Fix scroll through pinned items.
This commit is contained in:
parent
324affb8b9
commit
3febace163
1 changed files with 11 additions and 3 deletions
|
@ -5193,7 +5193,9 @@ void HistoryWidget::updatePinnedViewer() {
|
||||||
: (!_migrated || _pinnedClickedId.channel)
|
: (!_migrated || _pinnedClickedId.channel)
|
||||||
? _pinnedClickedId.msg
|
? _pinnedClickedId.msg
|
||||||
: (_pinnedClickedId.msg - ServerMaxMsgId);
|
: (_pinnedClickedId.msg - ServerMaxMsgId);
|
||||||
if (_pinnedClickedId && lessThanId <= lastClickedId) {
|
if (_pinnedClickedId
|
||||||
|
&& lessThanId <= lastClickedId
|
||||||
|
&& !_scrollToAnimation.animating()) {
|
||||||
_pinnedClickedId = FullMsgId();
|
_pinnedClickedId = FullMsgId();
|
||||||
}
|
}
|
||||||
if (_pinnedClickedId && !_minPinnedId) {
|
if (_pinnedClickedId && !_minPinnedId) {
|
||||||
|
@ -5201,7 +5203,7 @@ void HistoryWidget::updatePinnedViewer() {
|
||||||
_peer,
|
_peer,
|
||||||
_migrated ? _migrated->peer.get() : nullptr);
|
_migrated ? _migrated->peer.get() : nullptr);
|
||||||
}
|
}
|
||||||
if (_pinnedClickedId && _minPinnedId == _pinnedClickedId) {
|
if (_pinnedClickedId && _minPinnedId && _minPinnedId >= _pinnedClickedId) {
|
||||||
// After click on the last pinned message we should the top one.
|
// After click on the last pinned message we should the top one.
|
||||||
_pinnedTracker->trackAround(ServerMaxMsgId - 1);
|
_pinnedTracker->trackAround(ServerMaxMsgId - 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -5314,7 +5316,13 @@ void HistoryWidget::checkPinnedBarState() {
|
||||||
const auto id = _pinnedTracker->currentMessageId();
|
const auto id = _pinnedTracker->currentMessageId();
|
||||||
if (const auto item = session().data().message(id.message)) {
|
if (const auto item = session().data().message(id.message)) {
|
||||||
Ui::showPeerHistory(item->history()->peer, item->id);
|
Ui::showPeerHistory(item->history()->peer, item->id);
|
||||||
_pinnedClickedId = id.message;
|
if (const auto group = session().data().groups().find(item)) {
|
||||||
|
// Hack for the case when a non-first item of an album
|
||||||
|
// is pinned and we still want the 'show last after first'.
|
||||||
|
_pinnedClickedId = group->items.front()->fullId();
|
||||||
|
} else {
|
||||||
|
_pinnedClickedId = id.message;
|
||||||
|
}
|
||||||
_minPinnedId = std::nullopt;
|
_minPinnedId = std::nullopt;
|
||||||
updatePinnedViewer();
|
updatePinnedViewer();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue