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

Add some more actions to info profile.

This commit is contained in:
John Preston
2017-11-07 15:53:05 +04:00
parent 9f37820901
commit fcf2b9d1a7
12 changed files with 807 additions and 435 deletions

View File

@@ -132,6 +132,19 @@ rpl::producer<bool> IsContactValue(
| rpl::map([user] { return user->isContact(); });
}
rpl::producer<bool> CanInviteBotToGroupValue(
not_null<UserData*> user) {
if (!user->botInfo) {
return rpl::single(false);
}
return Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::BotCanAddToGroups)
| rpl::map([user] {
return !user->botInfo->cantJoinGroups;
});
}
rpl::producer<bool> CanShareContactValue(
not_null<UserData*> user) {
return Notify::PeerUpdateValue(
@@ -151,12 +164,20 @@ rpl::producer<bool> CanAddContactValue(
!$1 && $2);
}
rpl::producer<bool> AmInChannelValue(
not_null<ChannelData*> channel) {
return Notify::PeerUpdateValue(
channel,
Notify::PeerUpdate::Flag::ChannelAmIn)
| rpl::map([channel] { return channel->amIn(); });
}
rpl::producer<int> MembersCountValue(
not_null<PeerData*> peer) {
if (auto chat = peer->asChat()) {
return Notify::PeerUpdateValue(
peer,
Notify::PeerUpdate::Flag::MembersChanged)
peer,
Notify::PeerUpdate::Flag::MembersChanged)
| rpl::map([chat] {
return chat->amIn()
? qMax(chat->count, chat->participants.size())