mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Correct stories count in the Info title.
This commit is contained in:
parent
5179d9a03f
commit
547a5a14df
3 changed files with 6 additions and 3 deletions
|
@ -330,8 +330,8 @@ State::State(not_null<Data::Stories*> data, Data::StorySourcesList list)
|
|||
}
|
||||
|
||||
Content State::next() {
|
||||
auto result = Content();
|
||||
const auto &sources = _data->sources(_list);
|
||||
auto result = Content{ .total = int(sources.size()) };
|
||||
result.elements.reserve(sources.size());
|
||||
for (const auto &info : sources) {
|
||||
const auto source = _data->source(info.id);
|
||||
|
@ -390,8 +390,10 @@ rpl::producer<Content> LastForPeer(not_null<PeerData*> peer) {
|
|||
) | rpl::map([=] {
|
||||
auto ids = std::vector<StoryId>();
|
||||
auto readTill = StoryId();
|
||||
auto total = 0;
|
||||
if (const auto source = stories->source(peerId)) {
|
||||
readTill = source->readTill;
|
||||
total = int(source->ids.size());
|
||||
ids = ranges::views::all(source->ids)
|
||||
| ranges::views::reverse
|
||||
| ranges::views::take(kShownLastCount)
|
||||
|
@ -420,7 +422,7 @@ rpl::producer<Content> LastForPeer(not_null<PeerData*> peer) {
|
|||
}
|
||||
auto done = true;
|
||||
auto resolving = false;
|
||||
auto result = Content{};
|
||||
auto result = Content{ .total = total };
|
||||
for (const auto id : ids) {
|
||||
const auto storyId = FullStoryId{ peerId, id };
|
||||
const auto maybe = stories->lookup(storyId);
|
||||
|
|
|
@ -49,6 +49,7 @@ struct Element {
|
|||
|
||||
struct Content {
|
||||
std::vector<Element> elements;
|
||||
int total = 0;
|
||||
|
||||
friend inline bool operator==(
|
||||
const Content &a,
|
||||
|
|
|
@ -514,7 +514,7 @@ void TopBar::setStories(rpl::producer<Dialogs::Stories::Content> content) {
|
|||
rpl::duplicate(
|
||||
last
|
||||
) | rpl::start_with_next([=](const Content &content) {
|
||||
const auto count = int(content.elements.size());
|
||||
const auto count = content.total;
|
||||
if (_storiesCount != count) {
|
||||
const auto was = (_storiesCount > 0);
|
||||
_storiesCount = count;
|
||||
|
|
Loading…
Add table
Reference in a new issue