mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Remove unread bar in not-seen post comments opening.
This commit is contained in:
parent
809b0e9fe0
commit
9709297713
3 changed files with 13 additions and 12 deletions
|
@ -563,10 +563,12 @@ void ListWidget::checkUnreadBarCreation() {
|
|||
if (auto data = _delegate->listMessagesBar(_items); data.bar.element) {
|
||||
_bar = std::move(data.bar);
|
||||
_barText = std::move(data.text);
|
||||
_bar.element->createUnreadBar(_barText.value());
|
||||
const auto i = ranges::find(_items, not_null{ _bar.element });
|
||||
Assert(i != end(_items));
|
||||
refreshAttachmentsAtIndex(i - begin(_items));
|
||||
if (!_bar.hidden) {
|
||||
_bar.element->createUnreadBar(_barText.value());
|
||||
const auto i = ranges::find(_items, not_null{ _bar.element });
|
||||
Assert(i != end(_items));
|
||||
refreshAttachmentsAtIndex(i - begin(_items));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -586,7 +588,7 @@ void ListWidget::restoreScrollState() {
|
|||
return;
|
||||
}
|
||||
if (!_scrollTopState.item) {
|
||||
if (!_bar.element || !_bar.focus || _scrollInited) {
|
||||
if (!_bar.element || _bar.hidden || !_bar.focus || _scrollInited) {
|
||||
return;
|
||||
}
|
||||
_scrollInited = true;
|
||||
|
|
|
@ -53,6 +53,7 @@ struct SelectedItem {
|
|||
|
||||
struct MessagesBar {
|
||||
Element *element = nullptr;
|
||||
bool hidden = false;
|
||||
bool focus = false;
|
||||
};
|
||||
|
||||
|
|
|
@ -1722,22 +1722,20 @@ MessagesBarData RepliesWidget::listMessagesBar(
|
|||
return {};
|
||||
}
|
||||
const auto till = _root->computeRepliesInboxReadTillFull();
|
||||
if (till < 2) {
|
||||
return {};
|
||||
}
|
||||
const auto hidden = (till < 2);
|
||||
for (auto i = 0, count = int(elements.size()); i != count; ++i) {
|
||||
const auto item = elements[i]->data();
|
||||
if (IsServerMsgId(item->id) && item->id > till) {
|
||||
if (item->out() || !item->replyToId()) {
|
||||
readTill(item);
|
||||
} else {
|
||||
return MessagesBarData{
|
||||
// Designated initializers here crash MSVC 16.7.3.
|
||||
MessagesBar{
|
||||
return {
|
||||
.bar = {
|
||||
.element = elements[i],
|
||||
.hidden = hidden,
|
||||
.focus = true,
|
||||
},
|
||||
tr::lng_unread_bar_some(),
|
||||
.text = tr::lng_unread_bar_some(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue