diff --git a/ts/components/ForwardMessageModal.tsx b/ts/components/ForwardMessageModal.tsx index 1232f27fdc0..a11217ec8f4 100644 --- a/ts/components/ForwardMessageModal.tsx +++ b/ts/components/ForwardMessageModal.tsx @@ -291,6 +291,7 @@ export const ForwardMessageModal: FunctionComponent = ({ onEscape={handleBackOrClose} onClose={close} overlayStyles={overlayStyles} + useFocusTrap={false} > { if (isDirectConversation(this.attributes)) { - return this.isUnverified() - ? new window.Whisper.ConversationCollection([this]) - : new window.Whisper.ConversationCollection(); + return this.isUnverified() ? [this] : []; } - return new window.Whisper.ConversationCollection( + return ( this.contactCollection?.filter(contact => { if (isMe(contact.attributes)) { return false; } return contact.isUnverified(); - }) + }) || [] ); } @@ -2844,22 +2841,21 @@ export class ConversationModel extends window.Backbone }); } - getUntrusted(): ConversationModelCollectionType { + getUntrusted(): Array { if (isDirectConversation(this.attributes)) { if (this.isUntrusted()) { - return new window.Whisper.ConversationCollection([this]); + return [this]; } - return new window.Whisper.ConversationCollection(); + return []; } - return new window.Whisper.ConversationCollection( - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - this.contactCollection!.filter(contact => { + return ( + this.contactCollection?.filter(contact => { if (isMe(contact.attributes)) { return false; } return contact.isUntrusted(); - }) + }) || [] ); } diff --git a/ts/views/conversation_view.tsx b/ts/views/conversation_view.tsx index 132137c5ad8..6e9ccd3e4fa 100644 --- a/ts/views/conversation_view.tsx +++ b/ts/views/conversation_view.tsx @@ -18,7 +18,6 @@ import type { ConversationModel } from '../models/conversations'; import type { GroupV2PendingMemberType, MessageAttributesType, - ConversationModelCollectionType, QuotedMessageType, } from '../model-types.d'; import type { MediaItemType, MediaItemMessageType } from '../types/MediaItem'; @@ -2322,9 +2321,9 @@ export class ConversationView extends window.Backbone.View { async isCallSafe(): Promise { const contacts = await this.getUntrustedContacts(); - if (contacts && contacts.length) { + if (contacts.length) { const callAnyway = await this.showSendAnywayDialog( - contacts.models, + contacts, window.i18n('callAnyway') ); if (!callAnyway) { @@ -2366,8 +2365,8 @@ export class ConversationView extends window.Backbone.View { try { const contacts = await this.getUntrustedContacts(options); - if (contacts && contacts.length) { - const sendAnyway = await this.showSendAnywayDialog(contacts.models); + if (contacts.length) { + const sendAnyway = await this.showSendAnywayDialog(contacts); if (sendAnyway) { this.sendStickerMessage({ ...options, force: true }); } @@ -2388,7 +2387,7 @@ export class ConversationView extends window.Backbone.View { async getUntrustedContacts( options: { force?: boolean } = {} - ): Promise { + ): Promise> { const { model }: { model: ConversationModel } = this; // This will go to the trust store for the latest identity key information, @@ -2398,7 +2397,7 @@ export class ConversationView extends window.Backbone.View { if (options.force) { if (unverifiedContacts.length) { - await markAllAsVerifiedDefault(unverifiedContacts.models); + await markAllAsVerifiedDefault(unverifiedContacts); // We only want force to break us through one layer of checks // eslint-disable-next-line no-param-reassign options.force = false; @@ -2411,13 +2410,13 @@ export class ConversationView extends window.Backbone.View { if (options.force) { if (untrustedContacts.length) { - await markAllAsApproved(untrustedContacts.models); + await markAllAsApproved(untrustedContacts); } } else if (untrustedContacts.length) { return untrustedContacts; } - return null; + return []; } async setQuoteMessage(messageId: null | string): Promise { @@ -2560,8 +2559,8 @@ export class ConversationView extends window.Backbone.View { this.disableMessageField(); const contacts = await this.getUntrustedContacts(options); - if (contacts && contacts.length) { - const sendAnyway = await this.showSendAnywayDialog(contacts.models); + if (contacts.length) { + const sendAnyway = await this.showSendAnywayDialog(contacts); if (sendAnyway) { this.sendMessage(message, mentions, { force: true, timestamp }); return;