2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Info shared media and common groups counters.

This commit is contained in:
John Preston
2017-09-21 22:21:33 +03:00
parent 812dcb5e8d
commit b9fb9af74f
26 changed files with 1048 additions and 435 deletions

View File

@@ -174,11 +174,16 @@ void SharedMedia::List::removeAll() {
rpl::producer<SharedMediaResult> SharedMedia::List::query(
SharedMediaQuery &&query) const {
return [this, query = std::move(query)](auto consumer) {
auto slice = base::lower_bound(
_slices,
query.key.messageId,
[](const Slice &slice, MsgId id) { return slice.range.till < id; });
if (slice != _slices.end() && slice->range.from <= query.key.messageId) {
auto slice = query.key.messageId
? base::lower_bound(
_slices,
query.key.messageId,
[](const Slice &slice, MsgId id) {
return slice.range.till < id;
})
: _slices.end();
if (slice != _slices.end()
&& slice->range.from <= query.key.messageId) {
consumer.put_next(queryFromSlice(query, *slice));
} else if (_count) {
auto result = SharedMediaResult {};