2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Update API scheme on layer 145.

This commit is contained in:
John Preston
2022-08-22 12:15:34 +03:00
parent 33b266175d
commit f72092a261
25 changed files with 165 additions and 114 deletions

View File

@@ -459,16 +459,16 @@ rpl::producer<int> AllowedReactionsCountValue(not_null<PeerData*> peer) {
if (peer->isUser()) {
return FullReactionsCountValue(&peer->session());
}
return peer->session().changes().peerFlagsValue(
peer,
UpdateFlag::Reactions
) | rpl::map([=] {
if (const auto chat = peer->asChat()) {
return int(chat->allowedReactions().size());
} else if (const auto channel = peer->asChannel()) {
return int(channel->allowedReactions().size());
}
Unexpected("Peer type in AllowedReactionsCountValue.");
return rpl::combine(
FullReactionsCountValue(&peer->session()),
peer->session().changes().peerFlagsValue(
peer,
UpdateFlag::Reactions)
) | rpl::map([=](int full, const auto&) {
const auto &allowed = Data::PeerAllowedReactions(peer);
return (allowed.type == Data::AllowedReactionsType::Some)
? int(allowed.some.size())
: full;
});
}