Fix Create Chat: Can't create a channel without subscribers (#1115)

This commit is contained in:
Alexander Zinchuk 2021-05-24 13:09:54 +03:00
parent e2daa2a9a6
commit 5c1df65a0c
2 changed files with 15 additions and 11 deletions

View File

@ -101,11 +101,11 @@ const NewChatStep1: FC<OwnProps & StateProps & DispatchProps> = ({
]); ]);
const handleNextStep = useCallback(() => { const handleNextStep = useCallback(() => {
if (selectedMemberIds.length) { if (selectedMemberIds.length || isChannel) {
setGlobalSearchQuery({ query: '' }); setGlobalSearchQuery({ query: '' });
onNextStep(); onNextStep();
} }
}, [selectedMemberIds, setGlobalSearchQuery, onNextStep]); }, [selectedMemberIds.length, isChannel, setGlobalSearchQuery, onNextStep]);
const lang = useLang(); const lang = useLang();
@ -136,7 +136,7 @@ const NewChatStep1: FC<OwnProps & StateProps & DispatchProps> = ({
/> />
<FloatingActionButton <FloatingActionButton
isShown={Boolean(selectedMemberIds.length)} isShown={Boolean(selectedMemberIds.length || isChannel)}
onClick={handleNextStep} onClick={handleNextStep}
ariaLabel={isChannel ? 'Continue To Channel Info' : 'Continue To Group Info'} ariaLabel={isChannel ? 'Continue To Channel Info' : 'Continue To Group Info'}
> >

View File

@ -154,15 +154,19 @@ const NewChatStep2: FC<OwnProps & StateProps & DispatchProps> = ({
<p className="error">{renderedError}</p> <p className="error">{renderedError}</p>
)} )}
<h3 className="chat-members-heading">{lang('GroupInfo.ParticipantCount', memberIds.length, 'i')}</h3> {memberIds.length > 0 && (
<>
<h3 className="chat-members-heading">{lang('GroupInfo.ParticipantCount', memberIds.length, 'i')}</h3>
<div className="chat-members-list custom-scroll"> <div className="chat-members-list custom-scroll">
{memberIds.map((id) => ( {memberIds.map((id) => (
<ListItem inactive className="chat-item-clickable"> <ListItem inactive className="chat-item-clickable">
<PrivateChatInfo userId={id} /> <PrivateChatInfo userId={id} />
</ListItem> </ListItem>
))} ))}
</div> </div>
</>
)}
</div> </div>
<FloatingActionButton <FloatingActionButton