[FIX] mail: send button on mail channel show 'send'

closes odoo/odoo#79898

X-original-commit: 665f22de5ba6d73c28cc090a67d1179f8a6d99f0
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2021-11-16 22:53:20 +00:00
parent adc45af6de
commit 9dbeb68515
4 changed files with 43 additions and 5 deletions
+2 -2
View File
@@ -3729,7 +3729,7 @@ msgstr ""
#. module: mail
#. openerp-web
#: code:addons/mail/static/src/components/composer/composer.xml:0
#: code:addons/mail/static/src/models/composer_view/composer_view.js:0
#: code:addons/mail/static/src/xml/web_kanban_activity.xml:0
#: code:addons/mail/static/src/xml/web_kanban_activity.xml:0
#: model_terms:ir.ui.view,arch_db:mail.email_compose_message_wizard_form
@@ -5898,7 +5898,7 @@ msgstr ""
#. module: mail
#. openerp-web
#: code:addons/mail/static/src/components/composer/composer.xml:0
#: code:addons/mail/static/src/models/composer_view/composer_view.js:0
#: model_terms:ir.ui.view,arch_db:mail.email_compose_message_wizard_form
#, python-format
msgid "Send"
@@ -153,8 +153,6 @@
<t t-if="props.hasSendButton">
<button class="o_Composer_actionButton o_Composer_button o_Composer_buttonSend btn btn-primary"
t-att-class="{
'fa': messaging.device.isMobile,
'fa-paper-plane-o': messaging.device.isMobile,
'o-last': messaging.device.isMobile or !props.hasDiscardButton,
'o-composer-is-compact': props.isCompact,
'o-has-current-partner-avatar': props.hasCurrentPartnerAvatar,
@@ -163,7 +161,8 @@
type="button"
t-on-click="_onClickSend"
>
<t t-if="!messaging.device.isMobile"><t t-if="composerView.composer.isLog">Log</t><t t-else="">Send</t></t>
<t t-if="!messaging.device.isMobile"><t t-esc="composerView.sendButtonText"/></t>
<t t-else=""><i class="fa fa-paper-plane-o"/></t>
</button>
</t>
<t t-if="!messaging.device.isMobile and props.hasDiscardButton">
@@ -2141,6 +2141,23 @@ QUnit.test('[technical] does not crash when an attachment is removed before its
);
});
QUnit.test('send button on mail.channel should have "Send" as label', async function (assert) {
assert.expect(1);
this.data['mail.channel'].records.push({ id: 20 });
const { createComposerComponent } = await this.start();
const thread = this.messaging.models['mail.thread'].findFromIdentifyingData({
id: 20,
model: 'mail.channel',
});
await createComposerComponent(thread.composer);
assert.strictEqual(
document.querySelector('.o_Composer_buttonSend').textContent,
"Send",
"Send button of mail.channel composer should have 'Send' as label",
);
});
});
});
});
@@ -546,6 +546,22 @@ function factory(dependencies) {
}
}
/**
* @private
* @returns {string}
*/
_computeSendButtonText() {
if (
this.composer &&
this.composer.isLog &&
this.composer.activeThread &&
this.composer.activeThread.model !== 'mail.channel'
) {
return this.env._t("Log");
}
return this.env._t("Send");
}
/**
* @private
* @returns {string}
@@ -931,6 +947,12 @@ function factory(dependencies) {
inverse: 'composerViewInEditing',
readonly: true,
}),
/**
* Determines the label on the send button of this composer view.
*/
sendButtonText: attr({
compute: '_computeSendButtonText',
}),
/**
* States which type of suggestion is currently in progress, if any.
* The value of this field contains the magic char that corresponds to