[IMP] mail: turn 'ChatWindow/shiftPrevText' into field

Task-2793280

closes odoo/odoo#86435

Signed-off-by: Ooming <wil@odoo.com>
This commit is contained in:
Alexandre Kühn
2022-03-16 13:16:29 +01:00
parent 4d5652539a
commit 10adbacd8a
3 changed files with 14 additions and 11 deletions
@@ -21,16 +21,6 @@ export class ChatWindowHeader extends Component {
return this.messaging && this.messaging.models['ChatWindow'].get(this.props.chatWindowLocalId);
}
/**
* @returns {string}
*/
get shiftPrevText() {
if (this.messaging.locale.textDirection === 'rtl') {
return this.env._t("Shift right");
}
return this.env._t("Shift left");
}
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
@@ -56,7 +56,7 @@
</div>
</t>
<t t-if="chatWindow.hasShiftPrev">
<div class="o_ChatWindowHeader_command o_ChatWindowHeader_commandShiftPrev" t-att-class="{ 'o-mobile': messaging.device.isMobile }" t-on-click="_onClickShiftPrev" t-att-title="shiftPrevText">
<div class="o_ChatWindowHeader_command o_ChatWindowHeader_commandShiftPrev" t-att-class="{ 'o-mobile': messaging.device.isMobile }" t-on-click="_onClickShiftPrev" t-att-title="chatWindow.shiftPrevText">
<!-- this is reversed automatically when language is rtl -->
<i class="fa fa-angle-left"/>
</div>
@@ -303,6 +303,16 @@ registerModel({
}
return this.env._t("Shift right");
},
/**
* @private
* @returns {string}
*/
_computeShiftPrevText() {
if (this.messaging.locale.textDirection === 'rtl') {
return this.env._t("Shift right");
}
return this.env._t("Shift left");
},
/**
* @private
* @returns {ThreadViewer}
@@ -489,6 +499,9 @@ registerModel({
shiftNextText: attr({
compute: '_computeShiftNextText',
}),
shiftPrevText: attr({
compute: '_computeShiftPrevText',
}),
/**
* Determines the `Thread` that should be displayed by `this`.
* If no `Thread` is linked, `this` is considered "new message".