[IMP] mail: remove ComposerSuggestionComponent/is getters

Task-2793280

closes odoo/odoo#87735

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2022-04-01 17:56:54 +02:00
parent ce0648adce
commit 68ef0cd276
2 changed files with 8 additions and 24 deletions
@@ -34,22 +34,6 @@ export class ComposerSuggestion extends Component {
return this.messaging && this.messaging.models['ComposerView'].get(this.props.composerViewLocalId);
}
get isCannedResponse() {
return this.props.modelName === "CannedResponse";
}
get isChannel() {
return this.props.modelName === "Thread";
}
get isCommand() {
return this.props.modelName === "ChannelCommand";
}
get isPartner() {
return this.props.modelName === "Partner";
}
get record() {
return this.messaging && this.messaging.models[this.props.modelName].get(this.props.recordLocalId);
}
@@ -61,16 +45,16 @@ export class ComposerSuggestion extends Component {
* @returns {string}
*/
title() {
if (this.isCannedResponse) {
if (this.composerSuggestion.cannedResponse) {
return _.str.sprintf("%s: %s", this.record.source, this.record.substitution);
}
if (this.isChannel) {
if (this.composerSuggestion.thread) {
return this.record.name;
}
if (this.isCommand) {
if (this.composerSuggestion.channelCommand) {
return _.str.sprintf("%s: %s", this.record.name, this.record.help);
}
if (this.isPartner) {
if (this.composerSuggestion.partner) {
if (this.record.email) {
return _.str.sprintf("%s (%s)", this.record.nameOrDisplayName, this.record.email);
}
@@ -4,18 +4,18 @@
<t t-name="mail.ComposerSuggestion" owl="1">
<t t-if="composerSuggestion">
<a class="o_ComposerSuggestion dropdown-item d-flex w-100 py-2 px-4" t-att-class="{ 'active bg-300': props.isActive }" t-attf-class="{{ className }}" href="#" t-att-title="title()" role="menuitem" t-on-click="_onClick" t-ref="root">
<t t-if="isCannedResponse">
<t t-if="composerSuggestion.cannedResponse">
<strong class="o_ComposerSuggestion_part1 flex-shrink-0 mw-100 pr-2 text-truncate"><t t-esc="record.source"/></strong>
<em class="o_ComposerSuggestion_part2 text-600 text-truncate"><t t-esc="record.substitution"/></em>
</t>
<t t-if="isChannel">
<t t-if="composerSuggestion.thread">
<strong class="o_ComposerSuggestion_part1 flex-shrink-0 mw-100 pr-2 text-truncate"><t t-esc="record.name"/></strong>
</t>
<t t-if="isCommand">
<t t-if="composerSuggestion.channelCommand">
<strong class="o_ComposerSuggestion_part1 flex-shrink-0 mw-100 pr-2 text-truncate"><t t-esc="record.name"/></strong>
<em class="o_ComposerSuggestion_part2 text-600 text-truncate"><t t-esc="record.help"/></em>
</t>
<t t-if="isPartner">
<t t-if="composerSuggestion.partner">
<PartnerImStatusIcon
className="'o_ComposerSuggestion_partnerImStatusIcon flex-shrink-0 mr-1'"
hasBackground="false"