Browse Source

Fix upload parts (now 4000)

Fix out unread voice message
master
morethanwords 4 years ago
parent
commit
1dd4697c8c
  1. 8
      src/components/chat/contextMenu.ts
  2. 24
      src/lib/mtproto/apiFileManager.ts
  3. 2
      src/scss/partials/_chatBubble.scss

8
src/components/chat/contextMenu.ts

@ -69,7 +69,7 @@ export class ChatContextMenu { @@ -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 { @@ -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 { @@ -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',

24
src/lib/mtproto/apiFileManager.ts

@ -1,16 +1,16 @@ @@ -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<unknown>,
@ -421,10 +421,10 @@ export class ApiFileManager { @@ -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 { @@ -453,7 +453,7 @@ export class ApiFileManager {
notify: (details: {done: number, total: number}) => {}
};
const deferred: CancellablePromise<typeof resultInputFile> = new Promise((resolve, reject) => {
if(totalParts > 3000) {
if(totalParts > 4000) {
return reject({type: 'FILE_TOO_BIG'});
}
@ -462,7 +462,7 @@ export class ApiFileManager { @@ -462,7 +462,7 @@ export class ApiFileManager {
});
Object.assign(deferred, deferredHelper);
if(totalParts > 3000) {
if(totalParts > 4000) {
return deferred;
}

2
src/scss/partials/_chatBubble.scss

@ -1384,7 +1384,7 @@ $bubble-margin: .25rem; @@ -1384,7 +1384,7 @@ $bubble-margin: .25rem;
fill: #B8DDA9;
&.active {
fill: #68AB5A;
fill: #68AB5A !important;
}
}
}

Loading…
Cancel
Save