Browse Source

Fix some identifies

master
morethanwords 3 years ago
parent
commit
2fb747c584
  1. 6
      src/components/sidebarLeft/tabs/newGroup.ts
  2. 2
      src/components/sidebarRight/tabs/editContact.ts
  3. 2
      src/components/sidebarRight/tabs/sharedMedia.ts
  4. 2
      src/helpers/dom/getRichElementValue.ts
  5. 2
      src/helpers/peerIdPolyfill.ts
  6. 4
      src/lib/appManagers/appImManager.ts
  7. 2
      src/lib/appManagers/appInlineBotsManager.ts
  8. 2
      src/lib/appManagers/appMessagesManager.ts
  9. 4
      src/lib/appManagers/appProfileManager.ts
  10. 1
      src/lib/mtproto/mtprotoworker.ts
  11. 2
      src/lib/richtextprocessor.ts

6
src/components/sidebarLeft/tabs/newGroup.ts

@ -53,7 +53,7 @@ export default class AppNewGroupTab extends SliderSuperTab { @@ -53,7 +53,7 @@ export default class AppNewGroupTab extends SliderSuperTab {
const title = this.groupNameInputField.value;
this.nextBtn.disabled = true;
appChatsManager.createChat(title, this.peerIds).then((chatId) => {
appChatsManager.createChat(title, this.peerIds.map(peerId => peerId.toUserId())).then((chatId) => {
if(this.uploadAvatar) {
this.uploadAvatar().then((inputFile) => {
appChatsManager.editPhoto(chatId, inputFile);
@ -81,10 +81,10 @@ export default class AppNewGroupTab extends SliderSuperTab { @@ -81,10 +81,10 @@ export default class AppNewGroupTab extends SliderSuperTab {
this.nextBtn.disabled = false;
}
public open(userIds: PeerId[]) {
public open(peerIds: PeerId[]) {
const result = super.open();
result.then(() => {
this.peerIds = userIds;
this.peerIds = peerIds;
this.peerIds.forEach(userId => {
let {dom} = appDialogsManager.addDialogNew({

2
src/components/sidebarRight/tabs/editContact.ts

@ -31,7 +31,7 @@ export default class AppEditContactTab extends SliderSuperTab { @@ -31,7 +31,7 @@ export default class AppEditContactTab extends SliderSuperTab {
protected init() {
this.container.classList.add('edit-peer-container', 'edit-contact-container');
const isNew = !appUsersManager.isContact(this.peerId);
const isNew = !appUsersManager.isContact(this.peerId.toUserId());
this.setTitle(isNew ? 'AddContactTitle' : 'Edit');
{

2
src/components/sidebarRight/tabs/sharedMedia.ts

@ -433,7 +433,7 @@ export default class AppSharedMediaTab extends SliderSuperTab { @@ -433,7 +433,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
private toggleEditBtn() {
let show: boolean;
if(this.peerId.isUser()) {
show = this.peerId !== rootScope.myId && appUsersManager.isContact(this.peerId);
show = this.peerId !== rootScope.myId && appUsersManager.isContact(this.peerId.toUserId());
} else {
show = appChatsManager.hasRights(this.peerId.toChatId(), 'change_info');
}

2
src/helpers/dom/getRichElementValue.ts

@ -77,7 +77,7 @@ export default function getRichElementValue(node: HTMLElement, lines: string[], @@ -77,7 +77,7 @@ export default function getRichElementValue(node: HTMLElement, lines: string[],
_: tag.entityName,
offset: offset.offset,
length: nodeValue.length,
user_id: parentElement.dataset.follow
user_id: parentElement.dataset.follow.toUserId()
});
} else {
entities.push({

2
src/helpers/peerIdPolyfill.ts

@ -25,7 +25,7 @@ Number.prototype.toUserId = function() { @@ -25,7 +25,7 @@ Number.prototype.toUserId = function() {
};
Number.prototype.toChatId = function() {
return -this;
return Math.abs(this as any);
};
Number.prototype.toPeerId = function(isChat?: boolean) {

4
src/lib/appManagers/appImManager.ts

@ -535,8 +535,8 @@ export class AppImManager { @@ -535,8 +535,8 @@ export class AppImManager {
}
case INTERNAL_LINK_TYPE.PRIVATE_POST: {
const chatId: ChatId = link.channel;
const peerId = link.channel.toPeerId(true);
const chatId = link.channel.toChatId();
const peerId = chatId.toPeerId(true);
const chat = appChatsManager.getChat(chatId);
if(chat.deleted) {

2
src/lib/appManagers/appInlineBotsManager.ts

@ -107,7 +107,7 @@ export class AppInlineBotsManager { @@ -107,7 +107,7 @@ export class AppInlineBotsManager {
public switchToPM(fromPeerId: PeerId, botId: BotId, startParam: string) {
this.setHash[botId] = {peerId: fromPeerId, time: Date.now()};
rootScope.dispatchEvent('history_focus', {peerId: botId.toPeerId()});
return appMessagesManager.startBot(botId, '0', startParam);
return appMessagesManager.startBot(botId, undefined, startParam);
}
/*

2
src/lib/appManagers/appMessagesManager.ts

@ -3069,7 +3069,7 @@ export class AppMessagesManager { @@ -3069,7 +3069,7 @@ export class AppMessagesManager {
});
}
public startBot(botId: BotId, chatId: ChatId, startParam: string) {
public startBot(botId: BotId, chatId?: ChatId, startParam?: string) {
const peerId = chatId ? chatId.toPeerId(true) : botId.toPeerId();
if(startParam) {
const randomId = randomLong();

4
src/lib/appManagers/appProfileManager.ts

@ -170,7 +170,7 @@ export class AppProfileManager { @@ -170,7 +170,7 @@ export class AppProfileManager {
appUsersManager.saveApiUser(user, true);
if(userFull.profile_photo) {
userFull.profile_photo = appPhotosManager.savePhoto(userFull.profile_photo, {type: 'profilePhoto', peerId: peerId});
userFull.profile_photo = appPhotosManager.savePhoto(userFull.profile_photo, {type: 'profilePhoto', peerId});
}
if(userFull.about !== undefined) {
@ -262,7 +262,7 @@ export class AppProfileManager { @@ -262,7 +262,7 @@ export class AppProfileManager {
appUsersManager.saveApiUsers(result.users);
const fullChat = result.full_chat as ChatFull.chatFull;
if(fullChat && fullChat.chat_photo && fullChat.chat_photo.id) {
fullChat.chat_photo = appPhotosManager.savePhoto(fullChat.chat_photo, {type: 'profilePhoto', peerId: peerId});
fullChat.chat_photo = appPhotosManager.savePhoto(fullChat.chat_photo, {type: 'profilePhoto', peerId});
}
//appMessagesManager.savePinnedMessage(peerId, fullChat.pinned_msg_id);

1
src/lib/mtproto/mtprotoworker.ts

@ -31,7 +31,6 @@ import telegramMeWebManager from './telegramMeWebManager'; @@ -31,7 +31,6 @@ import telegramMeWebManager from './telegramMeWebManager';
import { CacheStorageDbName } from '../cacheStorage';
import { pause } from '../../helpers/schedulers/pause';
import IS_WEBP_SUPPORTED from '../../environment/webpSupport';
import appUsersManager from '../appManagers/appUsersManager';
type Task = {
taskId: number,

2
src/lib/richtextprocessor.ts

@ -305,7 +305,7 @@ namespace RichTextProcessor { @@ -305,7 +305,7 @@ namespace RichTextProcessor {
} else if(match[11]) { // custom mention
entity = {
_: 'messageEntityMentionName',
user_id: match[10],
user_id: match[10].toUserId(),
offset: matchIndex,
length: text.length
};

Loading…
Cancel
Save