[FIX] mail: Allow users to edit log notes in mobile

Example of steps:
	- Open any record with a chatter
	- Log a note
	- Edit it
	- Try to save

Actually it is impossible to save it, because we can not
perform a CTRL+ENTER in mobile and there is no button

This commit adds a button to save editing, using `fa-paper-plane`
icon similarly to send button.

opw-3784145

closes odoo/odoo#159092

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Achraf
2024-03-26 13:35:55 +00:00
committed by Alexandre Kühn
parent a4d6ed6332
commit bb2e76ee12
4 changed files with 32 additions and 87 deletions
+7 -87
View File
@@ -488,16 +488,6 @@ msgid ""
"creating new records for this alias."
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_bus_presence_partner_or_guest_exists
msgid "A bus presence must have a user or a guest."
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_discuss_channel_member_partner_or_guest_exists
msgid "A channel member must be a partner or a guest."
msgstr ""
#. module: mail
#. odoo-python
#: code:addons/mail/models/discuss/discuss_channel.py:0
@@ -514,11 +504,6 @@ msgid ""
"instead."
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_mail_message_reaction_partner_or_guest_exists
msgid "A message reaction must be from a partner or from a guest."
msgstr ""
#. module: mail
#. odoo-python
#: code:addons/mail/models/ir_actions_server.py:0
@@ -533,11 +518,6 @@ msgid ""
"https://cloud.google.com/translate/docs/setup"
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_res_users_settings_volumes_partner_or_guest_exists
msgid "A volume setting must have a partner or a guest."
msgstr ""
#. module: mail
#. odoo-javascript
#: code:addons/mail/static/src/discuss/call/common/call_invitation.xml:0
@@ -662,11 +642,6 @@ msgstr ""
msgid "Activities To Generate"
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_mail_activity_check_res_id_is_set
msgid "Activities have to be linked to records with a not null res_id."
msgstr ""
#. module: mail
#. odoo-javascript
#: code:addons/mail/static/src/core/web/activity_menu.xml:0
@@ -1554,11 +1529,6 @@ msgid ""
"Use another bounce or simply use the other alias domain."
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_mail_alias_domain_bounce_email_uniques
msgid "Bounce emails should be unique"
msgstr ""
#. module: mail
#. odoo-python
#: code:addons/mail/models/mail_alias_domain.py:0
@@ -1764,11 +1734,6 @@ msgid ""
"name. Use another catchall or simply use the other alias domain."
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_mail_alias_domain_catchall_email_uniques
msgid "Catchall emails should be unique"
msgstr ""
#. module: mail
#: model:ir.model.fields,field_description:mail.field_mail_mail__email_cc
#: model:ir.model.fields,field_description:mail.field_mail_template__email_cc
@@ -2457,11 +2422,6 @@ msgstr ""
msgid "Custom channel name"
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_mail_notification_notification_partner_required
msgid "Customer is required for inbox / email notification"
msgstr ""
#. module: mail
#: model_terms:ir.ui.view,arch_db:mail.res_config_settings_view_form
msgid "Customize the look and feel of automated emails"
@@ -3214,11 +3174,6 @@ msgstr ""
msgid "Email Thread"
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_mail_blacklist_unique_email
msgid "Email address already exists!"
msgstr ""
#. module: mail
#: model:ir.model.fields,help:mail.field_mail_compose_message__email_from
#: model:ir.model.fields,help:mail.field_mail_mail__email_from
@@ -3404,11 +3359,6 @@ msgid ""
"recipients."
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_mail_followers_mail_followers_res_partner_res_model_id_uniq
msgid "Error, a partner cannot follow twice the same object."
msgstr ""
#. module: mail
#: model:ir.model.fields.selection,name:mail.selection__mail_alias__alias_contact__everyone
msgid "Everyone"
@@ -3896,13 +3846,6 @@ msgstr ""
msgid "Group Name"
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_discuss_channel_group_public_id_check
msgid ""
"Group authorization and group auto-subscription are only supported on "
"channels."
msgstr ""
#. module: mail
#: model_terms:ir.ui.view,arch_db:mail.view_email_template_search
msgid "Group by..."
@@ -6487,11 +6430,6 @@ msgstr ""
msgid "Only custom models can be modified."
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_res_users_notification_type
msgid "Only internal user can receive notifications in Odoo"
msgstr ""
#. module: mail
#. odoo-python
#: code:addons/mail/models/mail_thread.py:0
@@ -7693,6 +7631,13 @@ msgstr ""
msgid "Save as a new template"
msgstr ""
#. module: mail
#. odoo-javascript
#: code:addons/mail/static/src/core/common/composer.js:0
#, python-format
msgid "Save editing"
msgstr ""
#. module: mail
#: model:ir.model,name:mail.model_discuss_gif_favorite
msgid "Save favorite GIF from Tenor API"
@@ -8786,16 +8731,6 @@ msgstr ""
msgid "The avatar has been updated!"
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_discuss_channel_uuid_unique
msgid "The channel UUID must be unique"
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_discuss_channel_channel_type_not_null
msgid "The channel type cannot be empty"
msgstr ""
#. module: mail
#: model:ir.model.fields,help:mail.field_mail_template__can_write
msgid "The current user can edit the template."
@@ -8813,11 +8748,6 @@ msgstr ""
msgid "The email sent to"
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_mail_partner_device_endpoint_unique
msgid "The endpoint must be unique !"
msgstr ""
#. module: mail
#. odoo-python
#: code:addons/mail/models/template_reset_mixin.py:0
@@ -8948,11 +8878,6 @@ msgstr ""
msgid "There are no messages in this conversation."
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_discuss_channel_rtc_session_channel_member_unique
msgid "There can only be one rtc session per channel member"
msgstr ""
#. module: mail
#: model_terms:ir.ui.view,arch_db:mail.message_origin_link
msgid "This"
@@ -9728,11 +9653,6 @@ msgstr ""
msgid "User is online"
msgstr ""
#. module: mail
#: model:ir.model.constraint,message:mail.constraint_discuss_gif_favorite_user_gif_favorite
msgid "User should not have duplicated favorite GIF"
msgstr ""
#. module: mail
#. odoo-python
#: code:addons/mail/models/mail_message.py:0
@@ -258,6 +258,9 @@ export class Composer extends Component {
}
get SEND_TEXT() {
if (this.props.composer.message) {
return _t("Save editing");
}
return this.props.type === "note" ? _t("Log") : _t("Send");
}
@@ -77,6 +77,7 @@
<button t-att-disabled="!state.active" class="o-mail-Composer-attachFiles btn border-0 rounded-pill" title="Attach files" aria-label="Attach files" type="button" t-on-click="onClickAddAttachment"><i class="fa fa-paperclip"/></button>
</t>
</FileUploader>
<t t-if="extended and ui.isSmall and props.composer.message" t-call="mail.Composer.sendButton"/>
</div>
<button t-if="props.showFullComposer and thread and thread.type === 'chatter'" class="o-mail-Composer-fullComposer btn fa fa-expand m-1 border-0 rounded-pill" title="Full composer" aria-label="Full composer" type="button" t-on-click="onClickFullComposer"/>
</div>
@@ -93,6 +93,27 @@ QUnit.test("Can edit message comment in chatter", async () => {
await contains(".o-mail-Message-content", { text: "edited message" });
});
QUnit.test("Can edit message comment in chatter (mobile)", async () => {
patchUiSize({ size: SIZES.SM });
const pyEnv = await startServer();
const partnerId = pyEnv["res.partner"].create({ name: "TestPartner" });
pyEnv["mail.message"].create({
author_id: pyEnv.currentPartnerId,
body: "original message",
message_type: "comment",
model: "res.partner",
res_id: partnerId,
});
const { openFormView } = await start();
openFormView("res.partner", partnerId);
await click(".o-mail-Message [title='Expand']");
await click(".o-mail-Message [title='Edit']");
await contains("button", { text: "Discard editing" });
await insertText(".o-mail-Message .o-mail-Composer-input", "edited message", { replace: true });
await click("button[aria-label='Save editing']");
await contains(".o-mail-Message-content", { text: "edited message" });
});
QUnit.test("Cursor is at end of composer input on edit", async (assert) => {
const pyEnv = await startServer();
const channelId = pyEnv["discuss.channel"].create({