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

Fix removing chats from dialogs.

This commit is contained in:
John Preston
2019-01-22 17:05:06 +04:00
parent ebc2043055
commit bf87de3706
5 changed files with 17 additions and 19 deletions

View File

@@ -39,10 +39,6 @@ void ChatData::setPhoto(PhotoId photoId, const MTPChatPhoto &photo) {
}
}
bool ChatData::actionsUnavailable() const {
return isDeactivated() || !amIn();
}
auto ChatData::DefaultAdminRights() -> AdminRights {
using Flag = AdminRight;
return Flag::f_change_info
@@ -54,17 +50,15 @@ auto ChatData::DefaultAdminRights() -> AdminRights {
bool ChatData::canWrite() const {
// Duplicated in Data::CanWriteValue().
return !actionsUnavailable()
&& !amRestricted(Restriction::f_send_messages);
return amIn() && !amRestricted(Restriction::f_send_messages);
}
bool ChatData::canEditInformation() const {
return !actionsUnavailable()
&& !amRestricted(Restriction::f_change_info);
return amIn() && !amRestricted(Restriction::f_change_info);
}
bool ChatData::canEditPermissions() const {
return !actionsUnavailable()
return amIn()
&& (amCreator() || (adminRights() & AdminRight::f_ban_users));
}
@@ -78,18 +72,15 @@ bool ChatData::canEditPreHistoryHidden() const {
}
bool ChatData::canAddMembers() const {
return !actionsUnavailable()
&& !amRestricted(Restriction::f_invite_users);
return amIn() && !amRestricted(Restriction::f_invite_users);
}
bool ChatData::canSendPolls() const {
return !actionsUnavailable()
&& !amRestricted(Restriction::f_send_polls);
return amIn() && !amRestricted(Restriction::f_send_polls);
}
bool ChatData::canAddAdmins() const {
return !actionsUnavailable()
&& amCreator();
return amIn() && amCreator();
}
bool ChatData::canBanMembers() const {