Fix releasing temporary message
This commit is contained in:
parent
780b995bad
commit
8b0254d6b3
@ -331,7 +331,9 @@ export function wrapVideo({doc, container, message, boxWidth, boxHeight, withTai
|
||||
|
||||
video.addEventListener('error', (e) => {
|
||||
console.error("Error " + video.error.code + "; details: " + video.error.message);
|
||||
preloader.detach();
|
||||
if(preloader) {
|
||||
preloader.detach();
|
||||
}
|
||||
}, {once: true});
|
||||
|
||||
if(!noAutoDownload && f) {
|
||||
|
14
src/layer.d.ts
vendored
14
src/layer.d.ts
vendored
@ -855,7 +855,8 @@ export namespace Message {
|
||||
fromId?: number,
|
||||
random_id?: string,
|
||||
rReply?: string,
|
||||
viaBotId?: number
|
||||
viaBotId?: number,
|
||||
clear_history?: boolean
|
||||
};
|
||||
|
||||
export type messageService = {
|
||||
@ -1881,7 +1882,7 @@ export namespace MessagesFilter {
|
||||
/**
|
||||
* @link https://core.telegram.org/type/Update
|
||||
*/
|
||||
export type Update = Update.updateNewMessage | Update.updateMessageID | Update.updateDeleteMessages | Update.updateUserTyping | Update.updateChatUserTyping | Update.updateChatParticipants | Update.updateUserStatus | Update.updateUserName | Update.updateUserPhoto | Update.updateNewEncryptedMessage | Update.updateEncryptedChatTyping | Update.updateEncryption | Update.updateEncryptedMessagesRead | Update.updateChatParticipantAdd | Update.updateChatParticipantDelete | Update.updateDcOptions | Update.updateNotifySettings | Update.updateServiceNotification | Update.updatePrivacy | Update.updateUserPhone | Update.updateReadHistoryInbox | Update.updateReadHistoryOutbox | Update.updateWebPage | Update.updateReadMessagesContents | Update.updateChannelTooLong | Update.updateChannel | Update.updateNewChannelMessage | Update.updateReadChannelInbox | Update.updateDeleteChannelMessages | Update.updateChannelMessageViews | Update.updateChatParticipantAdmin | Update.updateNewStickerSet | Update.updateStickerSetsOrder | Update.updateStickerSets | Update.updateSavedGifs | Update.updateBotInlineQuery | Update.updateBotInlineSend | Update.updateEditChannelMessage | Update.updateBotCallbackQuery | Update.updateEditMessage | Update.updateInlineBotCallbackQuery | Update.updateReadChannelOutbox | Update.updateDraftMessage | Update.updateReadFeaturedStickers | Update.updateRecentStickers | Update.updateConfig | Update.updatePtsChanged | Update.updateChannelWebPage | Update.updateDialogPinned | Update.updatePinnedDialogs | Update.updateBotWebhookJSON | Update.updateBotWebhookJSONQuery | Update.updateBotShippingQuery | Update.updateBotPrecheckoutQuery | Update.updatePhoneCall | Update.updateLangPackTooLong | Update.updateLangPack | Update.updateFavedStickers | Update.updateChannelReadMessagesContents | Update.updateContactsReset | Update.updateChannelAvailableMessages | Update.updateDialogUnreadMark | Update.updateMessagePoll | Update.updateChatDefaultBannedRights | Update.updateFolderPeers | Update.updatePeerSettings | Update.updatePeerLocated | Update.updateNewScheduledMessage | Update.updateDeleteScheduledMessages | Update.updateTheme | Update.updateGeoLiveViewed | Update.updateLoginToken | Update.updateMessagePollVote | Update.updateDialogFilter | Update.updateDialogFilterOrder | Update.updateDialogFilters | Update.updatePhoneCallSignalingData | Update.updateChannelMessageForwards | Update.updateReadChannelDiscussionInbox | Update.updateReadChannelDiscussionOutbox | Update.updatePeerBlocked | Update.updateChannelUserTyping | Update.updatePinnedMessages | Update.updatePinnedChannelMessages | Update.updateChat | Update.updateGroupCallParticipants | Update.updateGroupCall | Update.updatePeerHistoryTTL | Update.updateChatParticipant | Update.updateChannelParticipant | Update.updateBotStopped | Update.updateGroupCallConnection | Update.updateBotCommands | Update.updateNewDiscussionMessage | Update.updateDeleteDiscussionMessages;
|
||||
export type Update = Update.updateNewMessage | Update.updateMessageID | Update.updateDeleteMessages | Update.updateUserTyping | Update.updateChatUserTyping | Update.updateChatParticipants | Update.updateUserStatus | Update.updateUserName | Update.updateUserPhoto | Update.updateNewEncryptedMessage | Update.updateEncryptedChatTyping | Update.updateEncryption | Update.updateEncryptedMessagesRead | Update.updateChatParticipantAdd | Update.updateChatParticipantDelete | Update.updateDcOptions | Update.updateNotifySettings | Update.updateServiceNotification | Update.updatePrivacy | Update.updateUserPhone | Update.updateReadHistoryInbox | Update.updateReadHistoryOutbox | Update.updateWebPage | Update.updateReadMessagesContents | Update.updateChannelTooLong | Update.updateChannel | Update.updateNewChannelMessage | Update.updateReadChannelInbox | Update.updateDeleteChannelMessages | Update.updateChannelMessageViews | Update.updateChatParticipantAdmin | Update.updateNewStickerSet | Update.updateStickerSetsOrder | Update.updateStickerSets | Update.updateSavedGifs | Update.updateBotInlineQuery | Update.updateBotInlineSend | Update.updateEditChannelMessage | Update.updateBotCallbackQuery | Update.updateEditMessage | Update.updateInlineBotCallbackQuery | Update.updateReadChannelOutbox | Update.updateDraftMessage | Update.updateReadFeaturedStickers | Update.updateRecentStickers | Update.updateConfig | Update.updatePtsChanged | Update.updateChannelWebPage | Update.updateDialogPinned | Update.updatePinnedDialogs | Update.updateBotWebhookJSON | Update.updateBotWebhookJSONQuery | Update.updateBotShippingQuery | Update.updateBotPrecheckoutQuery | Update.updatePhoneCall | Update.updateLangPackTooLong | Update.updateLangPack | Update.updateFavedStickers | Update.updateChannelReadMessagesContents | Update.updateContactsReset | Update.updateChannelAvailableMessages | Update.updateDialogUnreadMark | Update.updateMessagePoll | Update.updateChatDefaultBannedRights | Update.updateFolderPeers | Update.updatePeerSettings | Update.updatePeerLocated | Update.updateNewScheduledMessage | Update.updateDeleteScheduledMessages | Update.updateTheme | Update.updateGeoLiveViewed | Update.updateLoginToken | Update.updateMessagePollVote | Update.updateDialogFilter | Update.updateDialogFilterOrder | Update.updateDialogFilters | Update.updatePhoneCallSignalingData | Update.updateChannelMessageForwards | Update.updateReadChannelDiscussionInbox | Update.updateReadChannelDiscussionOutbox | Update.updatePeerBlocked | Update.updateChannelUserTyping | Update.updatePinnedMessages | Update.updatePinnedChannelMessages | Update.updateChat | Update.updateGroupCallParticipants | Update.updateGroupCall | Update.updatePeerHistoryTTL | Update.updateChatParticipant | Update.updateChannelParticipant | Update.updateBotStopped | Update.updateGroupCallConnection | Update.updateBotCommands | Update.updateNewDiscussionMessage | Update.updateDeleteDiscussionMessages | Update.updateChannelReload;
|
||||
|
||||
export namespace Update {
|
||||
export type updateNewMessage = {
|
||||
@ -2195,7 +2196,8 @@ export namespace Update {
|
||||
_: 'updateDraftMessage',
|
||||
peer: Peer,
|
||||
draft: DraftMessage,
|
||||
local?: boolean
|
||||
local?: boolean,
|
||||
threadId?: number
|
||||
};
|
||||
|
||||
export type updateReadFeaturedStickers = {
|
||||
@ -2552,6 +2554,11 @@ export namespace Update {
|
||||
messages?: number[],
|
||||
channel_id?: number
|
||||
};
|
||||
|
||||
export type updateChannelReload = {
|
||||
_: 'updateChannelReload',
|
||||
channel_id?: number
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@ -9821,6 +9828,7 @@ export interface ConstructorDeclMap {
|
||||
'messageActionChatReturnYou': MessageAction.messageActionChatReturnYou,
|
||||
'updateNewDiscussionMessage': Update.updateNewDiscussionMessage,
|
||||
'updateDeleteDiscussionMessages': Update.updateDeleteDiscussionMessages,
|
||||
'updateChannelReload': Update.updateChannelReload,
|
||||
}
|
||||
|
||||
export type InvokeAfterMsg = {
|
||||
|
@ -366,7 +366,6 @@ export class ApiUpdatesManager {
|
||||
this.debug && this.log.debug('channel diff too long', differenceResult);
|
||||
delete this.channelStates[channelId];
|
||||
|
||||
// @ts-ignore
|
||||
this.saveUpdate({_: 'updateChannelReload', channel_id: channelId});
|
||||
return;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export class AppDraftsManager {
|
||||
rootScope.addMultipleEventsListeners({
|
||||
updateDraftMessage: (update) => {
|
||||
const peerID = appPeersManager.getPeerId(update.peer);
|
||||
this.saveDraft(peerID, (update as any).threadId, update.draft, {notify: true});
|
||||
this.saveDraft(peerID, update.threadId, update.draft, {notify: true});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -238,7 +238,6 @@ export class AppMessagesManager {
|
||||
|
||||
updateChannel: this.onUpdateChannel,
|
||||
|
||||
// @ts-ignore
|
||||
updateChannelReload: this.onUpdateChannelReload,
|
||||
|
||||
updateChannelMessageViews: this.onUpdateChannelMessageViews,
|
||||
@ -4017,8 +4016,7 @@ export class AppMessagesManager {
|
||||
|
||||
const dialog = this.getDialogOnly(peerId);
|
||||
const isTopMessage = dialog && dialog.top_message === mid;
|
||||
// @ts-ignore
|
||||
if(message.clear_history) { // that's will never happen
|
||||
if((message as Message.message).clear_history) {
|
||||
if(isTopMessage) {
|
||||
rootScope.dispatchEvent('dialog_flush', {peerId});
|
||||
}
|
||||
@ -4263,9 +4261,8 @@ export class AppMessagesManager {
|
||||
}
|
||||
};
|
||||
|
||||
private onUpdateChannelReload = (update: any) => {
|
||||
// @ts-ignore
|
||||
const channelId: number = update.channel_id;
|
||||
private onUpdateChannelReload = (update: Update.updateChannelReload) => {
|
||||
const channelId = update.channel_id;
|
||||
const peerId = -channelId;
|
||||
|
||||
this.dialogsStorage.dropDialog(peerId);
|
||||
@ -5104,20 +5101,18 @@ export class AppMessagesManager {
|
||||
});
|
||||
}
|
||||
|
||||
private handleReleasingMessage(message: any) {
|
||||
if((message as Message.message).media) {
|
||||
private handleReleasingMessage(message: MyMessage) {
|
||||
if('media' in message) {
|
||||
// @ts-ignore
|
||||
const c = message.media.webpage || message.media;
|
||||
const smth = c.photo || c.document;
|
||||
const smth: Photo.photo | MyDocument = c.photo || c.document;
|
||||
|
||||
if(smth?.file_reference) {
|
||||
referenceDatabase.deleteContext(smth.file_reference, {type: 'message', peerId: message.peerId, messageId: message.mid});
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
if(message.media.webpage) {
|
||||
// @ts-ignore
|
||||
appWebPagesManager.deleteWebPageFromPending(message.media.webpage, mid);
|
||||
if('webpage' in message.media) {
|
||||
appWebPagesManager.deleteWebPageFromPending(message.media.webpage, message.mid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,8 @@
|
||||
{"name": "unread", "type": "true"},
|
||||
{"name": "is_outgoing", "type": "true"},
|
||||
{"name": "rReply", "type": "string"},
|
||||
{"name": "viaBotId", "type": "number"}
|
||||
{"name": "viaBotId", "type": "number"},
|
||||
{"name": "clear_history", "type": "boolean"}
|
||||
]
|
||||
}, {
|
||||
"predicate": "messageService",
|
||||
@ -233,8 +234,15 @@
|
||||
}, {
|
||||
"predicate": "updateDraftMessage",
|
||||
"params": [
|
||||
{"name": "local", "type": "boolean"}
|
||||
{"name": "local", "type": "boolean"},
|
||||
{"name": "threadId", "type": "number"}
|
||||
]
|
||||
}, {
|
||||
"predicate": "updateChannelReload",
|
||||
"params": [
|
||||
{"name": "channel_id", "type": "number"}
|
||||
],
|
||||
"type": "Update"
|
||||
}, {
|
||||
"predicate": "messages.stickerSet",
|
||||
"params": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user