Display chat link instead of username
This commit is contained in:
parent
cc6084dd72
commit
97c368bf1d
@ -10,8 +10,8 @@ import { copyTextToClipboard } from "../helpers/clipboard";
|
|||||||
import replaceContent from "../helpers/dom/replaceContent";
|
import replaceContent from "../helpers/dom/replaceContent";
|
||||||
import ListenerSetter from "../helpers/listenerSetter";
|
import ListenerSetter from "../helpers/listenerSetter";
|
||||||
import { fastRaf } from "../helpers/schedulers";
|
import { fastRaf } from "../helpers/schedulers";
|
||||||
import { ChatFull, User } from "../layer";
|
import { Chat, ChatFull, User } from "../layer";
|
||||||
import { Channel } from "../lib/appManagers/appChatsManager";
|
import appChatsManager, { Channel } from "../lib/appManagers/appChatsManager";
|
||||||
import appImManager from "../lib/appManagers/appImManager";
|
import appImManager from "../lib/appManagers/appImManager";
|
||||||
import appMessagesManager from "../lib/appManagers/appMessagesManager";
|
import appMessagesManager from "../lib/appManagers/appMessagesManager";
|
||||||
import appNotificationsManager from "../lib/appManagers/appNotificationsManager";
|
import appNotificationsManager from "../lib/appManagers/appNotificationsManager";
|
||||||
@ -140,10 +140,11 @@ export default class PeerProfile {
|
|||||||
subtitleLangKey: 'SetUrlPlaceholder',
|
subtitleLangKey: 'SetUrlPlaceholder',
|
||||||
icon: 'link',
|
icon: 'link',
|
||||||
clickable: () => {
|
clickable: () => {
|
||||||
Promise.resolve(appProfileManager.getChatFull(this.peerId.toChatId())).then(chatFull => {
|
copyTextToClipboard(this.link.title.textContent);
|
||||||
copyTextToClipboard(chatFull.exported_invite.link);
|
// Promise.resolve(appProfileManager.getChatFull(this.peerId.toChatId())).then(chatFull => {
|
||||||
|
// copyTextToClipboard(chatFull.exported_invite.link);
|
||||||
toast(I18n.format('LinkCopied', true));
|
toast(I18n.format('LinkCopied', true));
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -310,9 +311,11 @@ export default class PeerProfile {
|
|||||||
|
|
||||||
// username
|
// username
|
||||||
if(this.canBeDetailed()) {
|
if(this.canBeDetailed()) {
|
||||||
let username = appPeersManager.getPeerUsername(peerId);
|
if(peerId.isUser()) {
|
||||||
if(username) {
|
const username = appPeersManager.getPeerUsername(peerId);
|
||||||
setText(appPeersManager.getPeerUsername(peerId), this.username);
|
if(username) {
|
||||||
|
setText(appPeersManager.getPeerUsername(peerId), this.username);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.notifications) {
|
if(this.notifications) {
|
||||||
@ -377,9 +380,16 @@ export default class PeerProfile {
|
|||||||
setText(RichTextProcessor.wrapRichText(peerFull.about), this.bio);
|
setText(RichTextProcessor.wrapRichText(peerFull.about), this.bio);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportedInvite = (peerFull as ChatFull.channelFull).exported_invite;
|
if(!peerId.isUser()) {
|
||||||
if(exportedInvite) {
|
const chat: Chat.channel = appChatsManager.getChat(peerId.toChatId());
|
||||||
setText(exportedInvite.link, this.link);
|
if(chat.username) {
|
||||||
|
setText('https://t.me/' + chat.username, this.link);
|
||||||
|
} else {
|
||||||
|
const exportedInvite = (peerFull as ChatFull.channelFull).exported_invite;
|
||||||
|
if(exportedInvite) {
|
||||||
|
setText(exportedInvite.link, this.link);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const location = (peerFull as ChatFull.channelFull).location;
|
const location = (peerFull as ChatFull.channelFull).location;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user