From 1dd4697c8c62942d7a0ef3fe073da7e6f8744cc0 Mon Sep 17 00:00:00 2001 From: morethanwords Date: Mon, 12 Oct 2020 01:06:30 +0300 Subject: [PATCH] Fix upload parts (now 4000) Fix out unread voice message --- src/components/chat/contextMenu.ts | 8 ++++---- src/lib/mtproto/apiFileManager.ts | 24 ++++++++++++------------ src/scss/partials/_chatBubble.scss | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/components/chat/contextMenu.ts b/src/components/chat/contextMenu.ts index ac6c7b4e..58a07c9f 100644 --- a/src/components/chat/contextMenu.ts +++ b/src/components/chat/contextMenu.ts @@ -69,7 +69,7 @@ export class ChatContextMenu { icon: 'reply', text: 'Reply', onClick: this.onReplyClick, - verify: (peerID: number) => peerID > 0 || appChatsManager.hasRights(-peerID, 'send') + verify: (peerID: number, msgID: number) => (peerID > 0 || appChatsManager.hasRights(-peerID, 'send')) && msgID > 0 }, { icon: 'edit', text: 'Edit', @@ -86,7 +86,7 @@ export class ChatContextMenu { onClick: this.onPinClick, verify: (peerID: number, msgID: number) => { const message = appMessagesManager.getMessage(msgID); - return message._ != 'messageService' && appImManager.pinnedMsgID != msgID && (peerID == $rootScope.myID || (peerID < 0 && appChatsManager.hasRights(-peerID, 'pin'))); + return msgID > 0 && message._ != 'messageService' && appImManager.pinnedMsgID != msgID && (peerID == $rootScope.myID || (peerID < 0 && appChatsManager.hasRights(-peerID, 'pin'))); } }, { icon: 'unpin', @@ -109,13 +109,13 @@ export class ChatContextMenu { verify: (peerID: number, msgID) => { const message = appMessagesManager.getMessage(msgID); const poll = message.media?.poll; - return appMessagesManager.canEditMessage(msgID, 'poll') && poll && !poll.pFlags.closed; + return appMessagesManager.canEditMessage(msgID, 'poll') && poll && !poll.pFlags.closed && msgID > 0; } }, { icon: 'forward', text: 'Forward', onClick: this.onForwardClick, - verify: () => true + verify: (peerID: number, msgID: number) => msgID > 0 }, { icon: 'delete danger', text: 'Delete', diff --git a/src/lib/mtproto/apiFileManager.ts b/src/lib/mtproto/apiFileManager.ts index 36306176..9c374641 100644 --- a/src/lib/mtproto/apiFileManager.ts +++ b/src/lib/mtproto/apiFileManager.ts @@ -1,16 +1,16 @@ -import { nextRandomInt, getFileNameByLocation } from "../bin_utils"; - +import { CancellablePromise, deferredPromise } from "../../helpers/cancellablePromise"; +import { notifyAll, notifySomeone } from "../../helpers/context"; +import { isSafari } from "../../helpers/userAgent"; +import { FileLocation, InputFile, InputFileLocation, UploadFile } from "../../layer"; +import { getFileNameByLocation, nextRandomInt } from "../bin_utils"; import cacheStorage from "../cacheStorage"; +import cryptoWorker from "../crypto/cryptoworker"; import FileManager from "../filemanager"; -import apiManager from "./apiManager"; import { logger, LogLevels } from "../logger"; -import { isSafari } from "../../helpers/userAgent"; -import cryptoWorker from "../crypto/cryptoworker"; -import { notifySomeone, notifyAll } from "../../helpers/context"; -import { InputFileLocation, FileLocation, InputFile, UploadFile } from "../../layer"; -import { CancellablePromise, deferredPromise } from "../../helpers/cancellablePromise"; +import apiManager from "./apiManager"; import { MOUNT_CLASS_TO } from "./mtproto_config"; + type Delayed = { offset: number, writeFilePromise: CancellablePromise, @@ -421,10 +421,10 @@ export class ApiFileManager { partSize = 262144, // 256 Kb activeDelta = 2; - if(fileSize > (524288 * 3000)) { + /* if(fileSize > (524288 * 3000)) { partSize = 1024 * 1024; activeDelta = 8; - } else if(fileSize > 67108864) { + } else */if(fileSize > 67108864) { partSize = 524288; activeDelta = 4; } else if(fileSize < 102400) { @@ -453,7 +453,7 @@ export class ApiFileManager { notify: (details: {done: number, total: number}) => {} }; const deferred: CancellablePromise = new Promise((resolve, reject) => { - if(totalParts > 3000) { + if(totalParts > 4000) { return reject({type: 'FILE_TOO_BIG'}); } @@ -462,7 +462,7 @@ export class ApiFileManager { }); Object.assign(deferred, deferredHelper); - if(totalParts > 3000) { + if(totalParts > 4000) { return deferred; } diff --git a/src/scss/partials/_chatBubble.scss b/src/scss/partials/_chatBubble.scss index 3c8f721a..8f20ea5c 100644 --- a/src/scss/partials/_chatBubble.scss +++ b/src/scss/partials/_chatBubble.scss @@ -1384,7 +1384,7 @@ $bubble-margin: .25rem; fill: #B8DDA9; &.active { - fill: #68AB5A; + fill: #68AB5A !important; } } }