Add toasts when t.me link is not found
This commit is contained in:
parent
cfd91e6a84
commit
30b52bc55f
@ -1882,7 +1882,7 @@ export default class ChatBubbles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.appMessagesManager.getNewHistory(peerId, this.chat.threadId).then((historyStorage) => {
|
this.appMessagesManager.getNewHistory(peerId, this.chat.threadId).then((historyStorage) => {
|
||||||
if(!middleware()) {
|
if(!middleware() || !historyStorage) {
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -551,12 +551,14 @@ const lang = {
|
|||||||
"Yesterday": "yesterday",
|
"Yesterday": "yesterday",
|
||||||
"LeaveAComment": "Leave a comment",
|
"LeaveAComment": "Leave a comment",
|
||||||
"ViewInChat": "View in chat",
|
"ViewInChat": "View in chat",
|
||||||
|
"LinkNotFound": "Unfortunately, you can\'t access this message. You are not a member of the chat where it was posted.",
|
||||||
|
|
||||||
// * macos
|
// * macos
|
||||||
"AccountSettings.Filters": "Chat Folders",
|
"AccountSettings.Filters": "Chat Folders",
|
||||||
"AccountSettings.Notifications": "Notifications and Sounds",
|
"AccountSettings.Notifications": "Notifications and Sounds",
|
||||||
"AccountSettings.PrivacyAndSecurity": "Privacy and Security",
|
"AccountSettings.PrivacyAndSecurity": "Privacy and Security",
|
||||||
"AccountSettings.Language": "Language",
|
"AccountSettings.Language": "Language",
|
||||||
|
"Alert.UserDoesntExists": "Sorry, this user doesn't seem to exist.",
|
||||||
"Appearance.Reset": "Reset to Defaults",
|
"Appearance.Reset": "Reset to Defaults",
|
||||||
"Bio.Description": "Any details such as age, occupation or city.\nExample: 23 y.o. designer from San Francisco",
|
"Bio.Description": "Any details such as age, occupation or city.\nExample: 23 y.o. designer from San Francisco",
|
||||||
"Channel.UsernameAboutChannel": "People can share this link with others and can find your channel using Telegram search.",
|
"Channel.UsernameAboutChannel": "People can share this link with others and can find your channel using Telegram search.",
|
||||||
|
@ -700,6 +700,18 @@ export class AppChatsManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public resolveChannel(id: number) {
|
||||||
|
return apiManager.invokeApiSingle('channels.getChannels', {
|
||||||
|
id: [{
|
||||||
|
_: 'inputChannel',
|
||||||
|
channel_id: id,
|
||||||
|
access_hash: '0'
|
||||||
|
}]
|
||||||
|
}).then(messagesChats => {
|
||||||
|
this.saveApiChats(messagesChats.chats);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const appChatsManager = new AppChatsManager();
|
const appChatsManager = new AppChatsManager();
|
||||||
|
@ -61,7 +61,7 @@ import PopupElement from '../../components/popups';
|
|||||||
import singleInstance from '../mtproto/singleInstance';
|
import singleInstance from '../mtproto/singleInstance';
|
||||||
import PopupStickers from '../../components/popups/stickers';
|
import PopupStickers from '../../components/popups/stickers';
|
||||||
import PopupJoinChatInvite from '../../components/popups/joinChatInvite';
|
import PopupJoinChatInvite from '../../components/popups/joinChatInvite';
|
||||||
import { toast } from '../../components/toast';
|
import { toast, toastNew } from '../../components/toast';
|
||||||
import debounce from '../../helpers/schedulers/debounce';
|
import debounce from '../../helpers/schedulers/debounce';
|
||||||
import { pause } from '../../helpers/schedulers/pause';
|
import { pause } from '../../helpers/schedulers/pause';
|
||||||
import appMessagesIdsManager from './appMessagesIdsManager';
|
import appMessagesIdsManager from './appMessagesIdsManager';
|
||||||
@ -328,12 +328,23 @@ export class AppImManager {
|
|||||||
uriParams: {thread?: number} | {comment?: number}
|
uriParams: {thread?: number} | {comment?: number}
|
||||||
}>({
|
}>({
|
||||||
name: 'im',
|
name: 'im',
|
||||||
callback: (params) => {
|
callback: async(params) => {
|
||||||
console.log(params);
|
console.log(params);
|
||||||
|
|
||||||
const {pathnameParams, uriParams} = params;
|
const {pathnameParams, uriParams} = params;
|
||||||
if(pathnameParams[0] === 'c') {
|
if(pathnameParams[0] === 'c') {
|
||||||
const peerId = -+pathnameParams[1];
|
const peerId = -+pathnameParams[1];
|
||||||
|
|
||||||
|
const chat = appChatsManager.getChat(-peerId);
|
||||||
|
if(chat.deleted) {
|
||||||
|
try {
|
||||||
|
await appChatsManager.resolveChannel(-peerId);
|
||||||
|
} catch(err) {
|
||||||
|
toastNew({langPackKey: 'LinkNotFound'});
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const postId = appMessagesIdsManager.generateMessageId(+pathnameParams[2]);
|
const postId = appMessagesIdsManager.generateMessageId(+pathnameParams[2]);
|
||||||
const threadId = 'thread' in uriParams ? appMessagesIdsManager.generateMessageId(+uriParams.thread) : undefined;
|
const threadId = 'thread' in uriParams ? appMessagesIdsManager.generateMessageId(+uriParams.thread) : undefined;
|
||||||
|
|
||||||
@ -354,7 +365,7 @@ export class AppImManager {
|
|||||||
|
|
||||||
private addAnchorListener<Params extends {pathnameParams?: any, uriParams?: any}>(options: {
|
private addAnchorListener<Params extends {pathnameParams?: any, uriParams?: any}>(options: {
|
||||||
name: 'showMaskedAlert' | 'execBotCommand' | 'searchByHashtag' | 'addstickers' | 'joinchat' | 'im',
|
name: 'showMaskedAlert' | 'execBotCommand' | 'searchByHashtag' | 'addstickers' | 'joinchat' | 'im',
|
||||||
callback: (params: Params, element: HTMLAnchorElement) => boolean | void,
|
callback: (params: Params, element: HTMLAnchorElement) => boolean | any,
|
||||||
parsePathname?: boolean,
|
parsePathname?: boolean,
|
||||||
parseUriParams?: boolean,
|
parseUriParams?: boolean,
|
||||||
}) {
|
}) {
|
||||||
@ -424,7 +435,9 @@ export class AppImManager {
|
|||||||
else return this.setInnerPeer(peerId, msgId);
|
else return this.setInnerPeer(peerId, msgId);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
if(err.type === 'USERNAME_NOT_OCCUPIED') {
|
if(err.type === 'USERNAME_NOT_OCCUPIED') {
|
||||||
toast(i18n('NoUsernameFound'));
|
toastNew({langPackKey: 'NoUsernameFound'});
|
||||||
|
} else if(err.type === 'USERNAME_INVALID') {
|
||||||
|
toastNew({langPackKey: 'Alert.UserDoesntExists'});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user