From c5b28f5163343c56aa8d127a7eb85aa9dd52d56a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Mon, 14 Mar 2022 13:52:13 +0000 Subject: [PATCH] [REF] mail: turn 'Composer/placeholder' into field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit moves the logic associated with the composer placeholder for two reasons: - move business logic from components to models - allow to easily override the placeholder in other module. This is uselfull for the feature allowing to leave comments on a spreadsheet. Task 2638411 (spreadsheet comments) Task 2793280 closes odoo/odoo#86381 Signed-off-by: Alexandre Kühn (aku) --- .../composer_text_input.js | 22 ---------------- .../composer_text_input.xml | 2 +- .../static/src/models/composer/composer.js | 25 +++++++++++++++++++ 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/addons/mail/static/src/components/composer_text_input/composer_text_input.js b/addons/mail/static/src/components/composer_text_input/composer_text_input.js index 16774d06ebb..b9abc199fd7 100644 --- a/addons/mail/static/src/components/composer_text_input/composer_text_input.js +++ b/addons/mail/static/src/components/composer_text_input/composer_text_input.js @@ -48,28 +48,6 @@ export class ComposerTextInput extends Component { return this.messaging && this.messaging.models['ComposerView'].get(this.props.localId); } - /** - * @returns {string} - */ - get textareaPlaceholder() { - if (!this.composerView) { - return ""; - } - if (!this.composerView.composer.thread) { - return ""; - } - if (this.composerView.composer.thread.model === 'mail.channel') { - if (this.composerView.composer.thread.correspondent) { - return _.str.sprintf(this.env._t("Message %s..."), this.composerView.composer.thread.correspondent.nameOrDisplayName); - } - return _.str.sprintf(this.env._t("Message #%s..."), this.composerView.composer.thread.displayName); - } - if (this.composerView.composer.isLog) { - return this.env._t("Log an internal note..."); - } - return this.env._t("Send a message to followers..."); - } - /** * Saves the composer text input state in store */ diff --git a/addons/mail/static/src/components/composer_text_input/composer_text_input.xml b/addons/mail/static/src/components/composer_text_input/composer_text_input.xml index 5c94af1851f..a70210d65dc 100644 --- a/addons/mail/static/src/components/composer_text_input/composer_text_input.xml +++ b/addons/mail/static/src/components/composer_text_input/composer_text_input.xml @@ -10,7 +10,7 @@ isBelow="props.hasMentionSuggestionsBelowPosition" /> -