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 {
icon: 'reply', icon: 'reply',
text: 'Reply', text: 'Reply',
onClick: this.onReplyClick, 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', icon: 'edit',
text: 'Edit', text: 'Edit',
@ -86,7 +86,7 @@ export class ChatContextMenu {
onClick: this.onPinClick, onClick: this.onPinClick,
verify: (peerID: number, msgID: number) => { verify: (peerID: number, msgID: number) => {
const message = appMessagesManager.getMessage(msgID); 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', icon: 'unpin',
@ -109,13 +109,13 @@ export class ChatContextMenu {
verify: (peerID: number, msgID) => { verify: (peerID: number, msgID) => {
const message = appMessagesManager.getMessage(msgID); const message = appMessagesManager.getMessage(msgID);
const poll = message.media?.poll; 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', icon: 'forward',
text: 'Forward', text: 'Forward',
onClick: this.onForwardClick, onClick: this.onForwardClick,
verify: () => true verify: (peerID: number, msgID: number) => msgID > 0
}, { }, {
icon: 'delete danger', icon: 'delete danger',
text: 'Delete', text: 'Delete',

24
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 cacheStorage from "../cacheStorage";
import cryptoWorker from "../crypto/cryptoworker";
import FileManager from "../filemanager"; import FileManager from "../filemanager";
import apiManager from "./apiManager";
import { logger, LogLevels } from "../logger"; import { logger, LogLevels } from "../logger";
import { isSafari } from "../../helpers/userAgent"; import apiManager from "./apiManager";
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 { MOUNT_CLASS_TO } from "./mtproto_config"; import { MOUNT_CLASS_TO } from "./mtproto_config";
type Delayed = { type Delayed = {
offset: number, offset: number,
writeFilePromise: CancellablePromise<unknown>, writeFilePromise: CancellablePromise<unknown>,
@ -421,10 +421,10 @@ export class ApiFileManager {
partSize = 262144, // 256 Kb partSize = 262144, // 256 Kb
activeDelta = 2; activeDelta = 2;
if(fileSize > (524288 * 3000)) { /* if(fileSize > (524288 * 3000)) {
partSize = 1024 * 1024; partSize = 1024 * 1024;
activeDelta = 8; activeDelta = 8;
} else if(fileSize > 67108864) { } else */if(fileSize > 67108864) {
partSize = 524288; partSize = 524288;
activeDelta = 4; activeDelta = 4;
} else if(fileSize < 102400) { } else if(fileSize < 102400) {
@ -453,7 +453,7 @@ export class ApiFileManager {
notify: (details: {done: number, total: number}) => {} notify: (details: {done: number, total: number}) => {}
}; };
const deferred: CancellablePromise<typeof resultInputFile> = new Promise((resolve, reject) => { const deferred: CancellablePromise<typeof resultInputFile> = new Promise((resolve, reject) => {
if(totalParts > 3000) { if(totalParts > 4000) {
return reject({type: 'FILE_TOO_BIG'}); return reject({type: 'FILE_TOO_BIG'});
} }
@ -462,7 +462,7 @@ export class ApiFileManager {
}); });
Object.assign(deferred, deferredHelper); Object.assign(deferred, deferredHelper);
if(totalParts > 3000) { if(totalParts > 4000) {
return deferred; return deferred;
} }

2
src/scss/partials/_chatBubble.scss

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

Loading…
Cancel
Save