Management: Fix changing admin rights (#2504)

This commit is contained in:
Alexander Zinchuk 2023-02-08 00:47:31 +01:00
parent 0c57ef9c48
commit cb881a1809
3 changed files with 8 additions and 2 deletions

View File

@ -48,6 +48,8 @@ const ManageChatAdministrators: FC<OwnProps & StateProps> = ({
onScreenSelect(ManagementScreens.GroupRecentActions);
}, [onScreenSelect]);
const canAddNewAdmins = Boolean(chat.isCreator || chat.adminRights?.addAdmins);
const adminMembers = useMemo(() => {
if (!chat.fullInfo?.adminMembersById) {
return [];
@ -126,7 +128,7 @@ const ManageChatAdministrators: FC<OwnProps & StateProps> = ({
))}
<FloatingActionButton
isShown
isShown={canAddNewAdmins}
onClick={handleAddAdminClick}
ariaLabel={lang('Channel.Management.AddModerator')}
>

View File

@ -158,6 +158,10 @@ const ManageGroupAdminRights: FC<OwnProps & StateProps> = ({
return true;
}
if (chat.isCreator) {
return false;
}
return !chat.adminRights![key];
}, [chat, isFormFullyDisabled]);

View File

@ -135,7 +135,7 @@ const ManageGroupMembers: FC<OwnProps & StateProps> = ({
const handleMemberClick = useCallback((id: string) => {
if (noAdmins) {
onChatMemberSelect!(id, false);
onChatMemberSelect!(id, true);
onScreenSelect!(ManagementScreens.ChatNewAdminRights);
} else {
closeManagement();