@@ -8,7 +8,6 @@ import type {
88 AtLeast ,
99 EncryptedMessageContent ,
1010 EncryptedContent ,
11- IUpload ,
1211} from '@rocket.chat/core-typings' ;
1312import { isEncryptedMessageContent } from '@rocket.chat/core-typings' ;
1413import { Emitter } from '@rocket.chat/emitter' ;
@@ -28,7 +27,6 @@ import { sdk } from '../../../app/utils/client/lib/SDKClient';
2827import { t } from '../../../app/utils/lib/i18n' ;
2928import { RoomSettingsEnum } from '../../../definition/IRoomTypeConfig' ;
3029import { Messages , Rooms , Subscriptions } from '../../stores' ;
31- import type { EncryptedFile } from '../chats/Upload' ;
3230import { roomCoordinator } from '../rooms/roomCoordinator' ;
3331
3432const 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