Profile: Fix public channels displaying a private link (#1304)

This commit is contained in:
Alexander Zinchuk 2021-07-21 17:44:47 +03:00
parent bf6c6ef035
commit 89fc01c58e
2 changed files with 6 additions and 6 deletions

View File

@ -112,7 +112,7 @@ const ChatExtra: FC<OwnProps & StateProps & DispatchProps> = ({
<span className="subtitle">{lang(userId ? 'UserBio' : 'Info')}</span> <span className="subtitle">{lang(userId ? 'UserBio' : 'Info')}</span>
</ListItem> </ListItem>
)} )}
{(canInviteUsers || !username) && !!link.length && ( {(canInviteUsers || !username) && link && (
<ListItem icon="mention" multiline narrow ripple onClick={() => copy(link, lang('SetUrlPlaceholder'))}> <ListItem icon="mention" multiline narrow ripple onClick={() => copy(link, lang('SetUrlPlaceholder'))}>
<div className="title">{link}</div> <div className="title">{link}</div>
<span className="subtitle">{lang('SetUrlPlaceholder')}</span> <span className="subtitle">{lang('SetUrlPlaceholder')}</span>

View File

@ -82,13 +82,13 @@ export function getChatDescription(chat: ApiChat) {
export function getChatLink(chat: ApiChat) { export function getChatLink(chat: ApiChat) {
const { username } = chat; const { username } = chat;
const { inviteLink } = chat.fullInfo || {}; if (username) {
return `https://t.me/${username}`;
if (inviteLink && inviteLink.length) {
return inviteLink;
} }
return username ? `https://t.me/${username}` : ''; const { inviteLink } = chat.fullInfo || {};
return inviteLink;
} }
export function getChatAvatarHash( export function getChatAvatarHash(