mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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) {
|
if (auto data = _delegate->listMessagesBar(_items); data.bar.element) {
|
||||||
_bar = std::move(data.bar);
|
_bar = std::move(data.bar);
|
||||||
_barText = std::move(data.text);
|
_barText = std::move(data.text);
|
||||||
_bar.element->createUnreadBar(_barText.value());
|
if (!_bar.hidden) {
|
||||||
const auto i = ranges::find(_items, not_null{ _bar.element });
|
_bar.element->createUnreadBar(_barText.value());
|
||||||
Assert(i != end(_items));
|
const auto i = ranges::find(_items, not_null{ _bar.element });
|
||||||
refreshAttachmentsAtIndex(i - begin(_items));
|
Assert(i != end(_items));
|
||||||
|
refreshAttachmentsAtIndex(i - begin(_items));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -586,7 +588,7 @@ void ListWidget::restoreScrollState() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!_scrollTopState.item) {
|
if (!_scrollTopState.item) {
|
||||||
if (!_bar.element || !_bar.focus || _scrollInited) {
|
if (!_bar.element || _bar.hidden || !_bar.focus || _scrollInited) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_scrollInited = true;
|
_scrollInited = true;
|
||||||
|
|
|
@ -53,6 +53,7 @@ struct SelectedItem {
|
||||||
|
|
||||||
struct MessagesBar {
|
struct MessagesBar {
|
||||||
Element *element = nullptr;
|
Element *element = nullptr;
|
||||||
|
bool hidden = false;
|
||||||
bool focus = false;
|
bool focus = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1722,22 +1722,20 @@ MessagesBarData RepliesWidget::listMessagesBar(
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const auto till = _root->computeRepliesInboxReadTillFull();
|
const auto till = _root->computeRepliesInboxReadTillFull();
|
||||||
if (till < 2) {
|
const auto hidden = (till < 2);
|
||||||
return {};
|
|
||||||
}
|
|
||||||
for (auto i = 0, count = int(elements.size()); i != count; ++i) {
|
for (auto i = 0, count = int(elements.size()); i != count; ++i) {
|
||||||
const auto item = elements[i]->data();
|
const auto item = elements[i]->data();
|
||||||
if (IsServerMsgId(item->id) && item->id > till) {
|
if (IsServerMsgId(item->id) && item->id > till) {
|
||||||
if (item->out() || !item->replyToId()) {
|
if (item->out() || !item->replyToId()) {
|
||||||
readTill(item);
|
readTill(item);
|
||||||
} else {
|
} else {
|
||||||
return MessagesBarData{
|
return {
|
||||||
// Designated initializers here crash MSVC 16.7.3.
|
.bar = {
|
||||||
MessagesBar{
|
|
||||||
.element = elements[i],
|
.element = elements[i],
|
||||||
|
.hidden = hidden,
|
||||||
.focus = true,
|
.focus = true,
|
||||||
},
|
},
|
||||||
tr::lng_unread_bar_some(),
|
.text = tr::lng_unread_bar_some(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue