Management: Fix changing admin rights (#2504)
This commit is contained in:
parent
0c57ef9c48
commit
cb881a1809
@ -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')}
|
||||
>
|
||||
|
||||
@ -158,6 +158,10 @@ const ManageGroupAdminRights: FC<OwnProps & StateProps> = ({
|
||||
return true;
|
||||
}
|
||||
|
||||
if (chat.isCreator) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !chat.adminRights![key];
|
||||
}, [chat, isFormFullyDisabled]);
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user