[IMP] mail: rename composer view "hasFocus" to "isFocused"

Consistency in naming with other models.

Part of task-2694206, split from main PR to ease its diff

closes odoo/odoo#84130

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Sébastien Theys
2022-02-07 19:04:03 +00:00
parent 96d2016cf6
commit cff09308cd
4 changed files with 12 additions and 12 deletions
@@ -4,7 +4,7 @@
<t t-name="mail.Composer" owl="1">
<div class="o_Composer"
t-att-class="{
'o-focused': composerView and composerView.hasFocus,
'o-focused': composerView and composerView.isFocused,
'o-has-current-partner-avatar': props.hasCurrentPartnerAvatar,
'o-has-footer': hasFooter,
'o-has-header': hasHeader,
@@ -145,7 +145,7 @@ export class ComposerTextInput extends Component {
}
if (this.composerView.composer.isLastStateChangeProgrammatic) {
this._textareaRef.el.value = this.composerView.composer.textInputContent;
if (this.composerView.hasFocus) {
if (this.composerView.isFocused) {
this._textareaRef.el.setSelectionRange(
this.composerView.composer.textInputCursorStart,
this.composerView.composer.textInputCursorEnd,
@@ -189,7 +189,7 @@ export class ComposerTextInput extends Component {
if (!this.composerView) {
return;
}
this.composerView.update({ hasFocus: true });
this.composerView.update({ isFocused: true });
}
/**
@@ -200,7 +200,7 @@ export class ComposerTextInput extends Component {
return;
}
this.saveStateInStore();
this.composerView.update({ hasFocus: false });
this.composerView.update({ isFocused: false });
}
/**
@@ -978,9 +978,6 @@ registerModel({
readonly: true,
required: true,
}),
hasFocus: attr({
default: false,
}),
/**
* States whether there is any result currently found for the current
* suggestion delimiter and search term, if applicable.
@@ -996,6 +993,9 @@ registerModel({
hasToScrollToActiveSuggestion: attr({
default: false,
}),
isFocused: attr({
default: false,
}),
/**
* Determines the main records that are currently suggested.
* Allows to have different model types of mentions through a dynamic
@@ -184,7 +184,7 @@ registerModel({
if (this.lastVisibleMessage !== this.lastMessage) {
return;
}
if (!this.hasComposerFocus) {
if (!this.isComposerFocused) {
// FIXME condition should not be on "composer is focused" but "threadView is active"
// See task-2277543
return;
@@ -336,9 +336,6 @@ registerModel({
extraClass: attr({
related: 'threadViewer.extraClass',
}),
hasComposerFocus: attr({
related: 'composerView.hasFocus',
}),
/**
* Determines whether this thread viewer has a member list.
* Only makes sense if thread.hasMemberListFeature is true.
@@ -360,6 +357,9 @@ registerModel({
hasTopbar: attr({
related: 'threadViewer.hasTopbar',
}),
isComposerFocused: attr({
related: 'composerView.isFocused',
}),
/**
* States whether `this.threadCache` is currently loading messages.
*
@@ -514,7 +514,7 @@ registerModel({
methodName: '_onThreadCacheIsLoadingChanged',
}),
new OnChange({
dependencies: ['hasComposerFocus', 'lastMessage', 'thread.lastNonTransientMessage', 'lastVisibleMessage', 'threadCache'],
dependencies: ['isComposerFocused', 'lastMessage', 'thread.lastNonTransientMessage', 'lastVisibleMessage', 'threadCache'],
methodName: '_computeThreadShouldBeSetAsSeen',
}),
],