diff --git a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js index be90205c4a9..f5f02da6990 100644 --- a/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js +++ b/addons/mail/static/src/components/attachment_viewer/attachment_viewer.js @@ -117,18 +117,6 @@ export class AttachmentViewer extends Component { } } - /** - * Display the previous attachment in the list of attachments. - * - * @private - */ - _previous() { - if (!this.attachmentViewer.dialogOwner || !this.attachmentViewer.dialogOwner.attachmentListOwnerAsAttachmentView) { - return; - } - this.attachmentViewer.dialogOwner.attachmentListOwnerAsAttachmentView.selectPreviousAttachment(); - } - /** * Prompt the browser print of this attachment. * @@ -291,7 +279,7 @@ export class AttachmentViewer extends Component { */ _onClickPrevious(ev) { ev.stopPropagation(); - this._previous(); + this.attachmentViewer.previous(); } /** @@ -359,7 +347,7 @@ export class AttachmentViewer extends Component { this.attachmentViewer.next(); break; case 'ArrowLeft': - this._previous(); + this.attachmentViewer.previous(); break; case 'Escape': this.attachmentViewer.close(); diff --git a/addons/mail/static/src/models/attachment_viewer.js b/addons/mail/static/src/models/attachment_viewer.js index 186c1a8db75..0036e77fd8a 100644 --- a/addons/mail/static/src/models/attachment_viewer.js +++ b/addons/mail/static/src/models/attachment_viewer.js @@ -23,7 +23,7 @@ registerModel({ return Boolean(this.component && this.component.root.el && this.component.root.el.contains(element)); }, /** - * Display the previous attachment in the list of attachments. + * Display the next attachment in the list of attachments. */ next() { if (!this.dialogOwner || !this.dialogOwner.attachmentListOwnerAsAttachmentView) { @@ -103,6 +103,15 @@ registerModel({ ev.stopPropagation(); this.update({ isImageLoading: false }); }, + /** + * Display the previous attachment in the list of attachments. + */ + previous() { + if (!this.dialogOwner || !this.dialogOwner.attachmentListOwnerAsAttachmentView) { + return; + } + this.dialogOwner.attachmentListOwnerAsAttachmentView.selectPreviousAttachment(); + }, /** * @private * @returns {string}