Skip to content

Commit 48a1c28

Browse files
committed
chore: revert rocketchat.e2e.room changes
1 parent 4b576ce commit 48a1c28

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

apps/meteor/client/lib/chats/flows/uploadFiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const uploadFiles = async (
5858
return;
5959
}
6060

61-
if (!(await e2eRoom.readyToEncrypt())) {
61+
if (!e2eRoom.isReady()) {
6262
uploadFile(file);
6363
return;
6464
}

apps/meteor/client/lib/e2ee/rocketchat.e2e.room.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type {
88
AtLeast,
99
EncryptedMessageContent,
1010
EncryptedContent,
11-
IUpload,
1211
} from '@rocket.chat/core-typings';
1312
import { isEncryptedMessageContent } from '@rocket.chat/core-typings';
1413
import { Emitter } from '@rocket.chat/emitter';
@@ -28,7 +27,6 @@ import { sdk } from '../../../app/utils/client/lib/SDKClient';
2827
import { t } from '../../../app/utils/lib/i18n';
2928
import { RoomSettingsEnum } from '../../../definition/IRoomTypeConfig';
3029
import { Messages, Rooms, Subscriptions } from '../../stores';
31-
import type { EncryptedFile } from '../chats/Upload';
3230
import { roomCoordinator } from '../rooms/roomCoordinator';
3331

3432
const log = createLogger('E2E:Room');
@@ -166,7 +164,7 @@ export class E2ERoom extends Emitter {
166164
this.setState('KEYS_RECEIVED');
167165
}
168166

169-
async readyToEncrypt() {
167+
async shouldConvertSentMessages(message: { msg: string }) {
170168
if (!this.isReady() || this[PAUSED]) {
171169
return false;
172170
}
@@ -177,17 +175,11 @@ export class E2ERoom extends Emitter {
177175
});
178176
}
179177

180-
return true;
181-
}
182-
183-
async shouldConvertSentMessages(message: { msg: string }) {
184-
if (!(await this.readyToEncrypt())) {
185-
return false;
186-
}
187-
188178
if (message.msg[0] === '/') {
189179
return false;
190180
}
181+
182+
return true;
191183
}
192184

193185
shouldConvertReceivedMessages() {
@@ -580,7 +572,7 @@ export class E2ERoom extends Emitter {
580572
}
581573

582574
// Encrypts files before upload. I/O is in arraybuffers.
583-
async encryptFile(file: File): Promise<EncryptedFile | void> {
575+
async encryptFile(file: File) {
584576
const span = log.span('encryptFile');
585577

586578
const fileArrayBuffer = await file.arrayBuffer();
@@ -636,7 +628,7 @@ export class E2ERoom extends Emitter {
636628

637629
// Helper function for encryption of content
638630
async encryptMessageContent(
639-
contentToBeEncrypted: (Pick<IMessage, 'attachments' | 'files' | 'file'> & Optional<Pick<IMessage, 'msg'>, 'msg'>) | Partial<IUpload>,
631+
contentToBeEncrypted: Pick<IMessage, 'attachments' | 'files' | 'file'> & Optional<Pick<IMessage, 'msg'>, 'msg'>,
640632
) {
641633
const data = new TextEncoder().encode(EJSON.stringify(contentToBeEncrypted));
642634

0 commit comments

Comments
 (0)