Skip to content

Commit 3d5821d

Browse files
author
Ioan Moldovan
authored
#5822 Fix: deprecated errors (#5842)
* fix: deprecated errors * fix: ui tests * fix: ui tests * fix: pr reviews
1 parent cff2332 commit 3d5821d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+200
-103
lines changed

eslint.config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ const commonConfig = {
7272
format: ['camelCase', 'PascalCase'],
7373
},
7474
],
75-
// should be enabled in https://github.com/FlowCrypt/flowcrypt-browser/issues/5822
76-
'@typescript-eslint/no-deprecated': 'off',
75+
'@typescript-eslint/no-deprecated': 'warn',
7776
'@typescript-eslint/no-empty-interface': 'off',
7877
'@typescript-eslint/no-explicit-any': ['warn'],
7978
'@typescript-eslint/no-extraneous-class': 'off',

extension/chrome/elements/add_pubkey.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ View.run(
7676
}
7777
},
7878
});
79-
$('select.copy_from_email').change(this.setHandler(el => this.copyFromEmailHandler(el)));
79+
$('select.copy_from_email').on(
80+
'change',
81+
this.setHandler(el => this.copyFromEmailHandler(el))
82+
);
8083
$('.action_ok').on(
8184
'click',
8285
this.setHandler(() => this.submitHandler())

extension/chrome/elements/attachment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ export class AttachmentDownloadView extends View {
376376
const result = await this.gmail.msgGet(this.attachment.msgId, 'full');
377377
if (result?.payload?.parts) {
378378
for (const attMeta of result.payload.parts) {
379-
if (attMeta.filename === name && attMeta.body && attMeta.body.size === this.size && attMeta.body.attachmentId) {
379+
if (attMeta.filename === this.name && attMeta.body && attMeta.body.size === this.size && attMeta.body.attachmentId) {
380380
this.attachment.id = attMeta.body.attachmentId;
381381
return;
382382
}

extension/chrome/elements/attachment_preview.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import { AttachmentWarnings } from './shared/attachment_warnings.js';
1717
import * as pdfjsLib from 'pdfjs';
1818
import { AttachmentPreviewPdf } from '../../js/common/ui/attachment_preview_pdf.js';
1919

20+
// https://github.com/FlowCrypt/flowcrypt-browser/issues/5822#issuecomment-2362529197
21+
// eslint-disable-next-line @typescript-eslint/no-deprecated
2022
pdfjsLib.GlobalWorkerOptions.workerSrc = chrome.runtime.getURL(`lib/pdf.worker.min.mjs`);
2123
type AttachmentType = 'img' | 'txt' | 'pdf';
2224

extension/chrome/elements/backup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ View.run(
7070
'click',
7171
this.setHandler(async () => this.testPassphraseHandler())
7272
);
73-
$('#pass_phrase').keydown(this.setEnterHandlerThatClicks('.action_test_pass'));
73+
$('#pass_phrase').on('keydown', this.setEnterHandlerThatClicks('.action_test_pass'));
7474
};
7575

7676
private sendResizeMsg = () => {

extension/chrome/elements/compose-modules/compose-attachments-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class ComposeAttachmentsModule extends ViewModule<ComposeView> {
1717
}
1818

1919
public setHandlers = () => {
20-
this.view.S.cached('body').bind({ drop: Ui.event.stop(), dragover: Ui.event.stop() }); // prevents files dropped out of the intended drop area to interfere
20+
this.view.S.cached('body').on({ drop: Ui.event.stop(), dragover: Ui.event.stop() }); // prevents files dropped out of the intended drop area to interfere
2121
this.attachment.initAttachmentDialog('fineuploader', 'fineuploader_button', {
2222
uiChanged: () => {
2323
this.view.sizeModule.setInputTextHeightManuallyIfNeeded();

extension/chrome/elements/compose-modules/compose-recipients-module.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,18 @@ export class ComposeRecipientsModule extends ViewModule<ComposeView> {
108108
this.view.S.cached('input_to').trigger('focus');
109109
})
110110
);
111-
this.view.S.cached('input_to').focus(this.view.setHandler(() => this.focusRecipients()));
112-
this.view.S.cached('cc').focus(this.view.setHandler(() => this.focusRecipients()));
113-
this.view.S.cached('bcc').focus(this.view.setHandler(() => this.focusRecipients()));
111+
this.view.S.cached('input_to').on(
112+
'focus',
113+
this.view.setHandler(() => this.focusRecipients())
114+
);
115+
this.view.S.cached('cc').on(
116+
'focus',
117+
this.view.setHandler(() => this.focusRecipients())
118+
);
119+
this.view.S.cached('bcc').on(
120+
'focus',
121+
this.view.setHandler(() => this.focusRecipients())
122+
);
114123
this.view.S.cached('compose_table').on(
115124
'click',
116125
this.view.setHandler(() => this.hideContacts(), this.view.errModule.handle(`hide contact box`))
@@ -568,7 +577,7 @@ export class ComposeRecipientsModule extends ViewModule<ComposeView> {
568577
}
569578
}
570579
return false;
571-
} else if (e.keyCode === 32) {
580+
} else if (e.key === 'Space') {
572581
// Handle 'Space' key
573582
const target = $(e.target);
574583
const emails = String(target.val())
@@ -808,7 +817,7 @@ export class ComposeRecipientsModule extends ViewModule<ComposeView> {
808817
displayEmail = contact.email;
809818
} else {
810819
const parts = contact.email.split('@');
811-
displayEmail = parts[0].replace(/<\/?b>/g, '').substr(0, 10) + '...@' + parts[1];
820+
displayEmail = parts[0].replace(/<\/?b>/g, '').substring(0, 10) + '...@' + parts[1];
812821
}
813822
displayEmail = '<div class="select_contact_email" data-test="action-select-contact-email">' + Xss.escape(displayEmail) + '</div>';
814823
if (contact.name) {
@@ -835,7 +844,7 @@ export class ComposeRecipientsModule extends ViewModule<ComposeView> {
835844
this.view.errModule.handle(`select contact`)
836845
)
837846
);
838-
contactItems.hover(function () {
847+
contactItems.on('hover', function () {
839848
contactItems.removeClass('active');
840849
$(this).addClass('active');
841850
});

extension/chrome/elements/compose-modules/compose-render-module.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,12 +371,13 @@ export class ComposeRenderModule extends ViewModule<ComposeView> {
371371
};
372372

373373
private addComposeTableHandlers = async () => {
374-
this.view.S.cached('body').keydown(
374+
this.view.S.cached('body').on(
375+
'keydown',
375376
this.view.setHandler((el, ev) => {
376377
this.onBodyKeydownHandler(el, ev);
377378
})
378379
);
379-
this.view.S.cached('input_to').bind(
380+
this.view.S.cached('input_to').on(
380381
'paste',
381382
this.view.setHandler((el, ev) => this.onRecipientPasteHandler(el, ev))
382383
);
@@ -391,7 +392,7 @@ export class ComposeRenderModule extends ViewModule<ComposeView> {
391392
.children()
392393
.on('click', () => false);
393394
this.view.S.cached('input_subject')
394-
.bind(
395+
.on(
395396
'input',
396397
this.view.setHandler((el: HTMLInputElement) => {
397398
this.subjectRTLHandler(el);

extension/chrome/elements/compose-modules/compose-reply-btn-popover-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class ComposeReplyBtnPopoverModule extends ViewModule<ComposeView> {
6969
if (replyContainer.hasClass('popover-opened')) {
7070
$('body').on('click', popoverClickHandler);
7171
const replyOptions = this.view.S.cached('reply_options_container').find('.reply-option');
72-
replyOptions.hover(function () {
72+
replyOptions.on('hover', function () {
7373
replyOptions.removeClass('active');
7474
$(this).addClass('active');
7575
});

extension/chrome/elements/compose-modules/compose-send-btn-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class ComposeSendBtnModule extends ViewModule<ComposeView> {
3737

3838
public setHandlers = (): void => {
3939
const ctrlEnterHandler = Ui.ctrlEnter(() => !this.view.sizeModule.composeWindowIsMinimized && this.extractProcessSendMsg());
40-
this.view.S.cached('subject').add(this.view.S.cached('compose')).keydown(ctrlEnterHandler);
40+
this.view.S.cached('subject').add(this.view.S.cached('compose')).on('keydown', ctrlEnterHandler);
4141
this.view.S.cached('send_btn').on(
4242
'click',
4343
this.view.setHandlerPrevent('double', () => this.extractProcessSendMsg())

0 commit comments

Comments
 (0)