diff --git a/addons/mail/static/src/components/composer_suggestion_view/composer_suggestion_view.js b/addons/mail/static/src/components/composer_suggestion_view/composer_suggestion_view.js index 0608b22836b..3cc0debf443 100644 --- a/addons/mail/static/src/components/composer_suggestion_view/composer_suggestion_view.js +++ b/addons/mail/static/src/components/composer_suggestion_view/composer_suggestion_view.js @@ -37,7 +37,7 @@ export class ComposerSuggestionView extends Component { if ( this.root.el && this.composerSuggestionView.composerViewOwner.hasToScrollToActiveSuggestionView && - this.composerSuggestionView.isActive + this.composerSuggestionView.composerViewOwnerAsActiveSuggestionView ) { this.root.el.scrollIntoView({ block: 'center', diff --git a/addons/mail/static/src/components/composer_suggestion_view/composer_suggestion_view.xml b/addons/mail/static/src/components/composer_suggestion_view/composer_suggestion_view.xml index 0c295b6ef92..99d2efd8b9a 100644 --- a/addons/mail/static/src/components/composer_suggestion_view/composer_suggestion_view.xml +++ b/addons/mail/static/src/components/composer_suggestion_view/composer_suggestion_view.xml @@ -3,7 +3,7 @@ - + diff --git a/addons/mail/static/src/models/composer_suggestion_view.js b/addons/mail/static/src/models/composer_suggestion_view.js index fd75a1249fb..d664f6021e2 100644 --- a/addons/mail/static/src/models/composer_suggestion_view.js +++ b/addons/mail/static/src/models/composer_suggestion_view.js @@ -38,19 +38,6 @@ registerModel({ } return clear(); }, - /** - * @private - * @returns {boolean|FieldCommand} - */ - _computeIsActive() { - if (this.composerSuggestionListViewOwnerAsMainSuggestion && this === this.composerSuggestionListViewOwnerAsMainSuggestion.composerViewOwner.activeSuggestionView) { - return true; - } - if (this.composerSuggestionListViewOwnerAsExtraSuggestion && this === this.composerSuggestionListViewOwnerAsExtraSuggestion.composerViewOwner.activeSuggestionView) { - return true; - } - return clear(); - }, /** * @private * @returns {string} @@ -104,6 +91,9 @@ registerModel({ compute: '_computeComposerViewOwner', required: true, }), + composerViewOwnerAsActiveSuggestionView: one('ComposerView', { + inverse: 'activeSuggestionView', + }), composerSuggestionListViewOwnerAsExtraSuggestion: one('ComposerSuggestionListView', { inverse: 'extraSuggestionViews', readonly: true, @@ -112,10 +102,6 @@ registerModel({ inverse: 'mainSuggestionViews', readonly: true, }), - isActive: attr({ - compute: '_computeIsActive', - default: false, - }), /** * The text that identifies this suggestion in a mention. */ diff --git a/addons/mail/static/src/models/composer_view.js b/addons/mail/static/src/models/composer_view.js index 9bc713151ae..6b1f24afc97 100644 --- a/addons/mail/static/src/models/composer_view.js +++ b/addons/mail/static/src/models/composer_view.js @@ -1407,6 +1407,7 @@ registerModel({ */ activeSuggestionView: one('ComposerSuggestionView', { compute: '_computeActiveSuggestionView', + inverse: 'composerViewOwnerAsActiveSuggestionView', }), /** * Determines the attachment list that will be used to display the attachments.