From 023461cd063d335de7aab855afb03cf74b32ddac Mon Sep 17 00:00:00 2001 From: "Didier (did)" Date: Tue, 12 Sep 2023 15:26:16 +0200 Subject: [PATCH] [FIX] mail: fix composer render when switching chatter record MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To reproduce this bug: - Open a record with a chatter - Open a composer (send message or log note) - Change record using the pager - Now, you cannot mention anyone This is because the chatter component is reused and the `useComponent` hook isn't refreshed with the new data. This PR fix the issue by forcing a re-render of the composer when the `threadId` changes. This refresh the `useComponent` hook used inside the `useSuggestion` hook. task-3502720 closes odoo/odoo#135331 X-original-commit: 28dd108294606499799e1fd2a7b24de23730d098 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/core/web/chatter.xml | 2 +- addons/mail/static/tests/web/chatter_tests.js | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/core/web/chatter.xml b/addons/mail/static/src/core/web/chatter.xml index 1065a043ab2..072223080db 100644 --- a/addons/mail/static/src/core/web/chatter.xml +++ b/addons/mail/static/src/core/web/chatter.xml @@ -79,7 +79,7 @@ - +
diff --git a/addons/mail/static/tests/web/chatter_tests.js b/addons/mail/static/tests/web/chatter_tests.js index 75aaf8022e9..b30ebc5da56 100644 --- a/addons/mail/static/tests/web/chatter_tests.js +++ b/addons/mail/static/tests/web/chatter_tests.js @@ -810,3 +810,37 @@ QUnit.test("Follower count of draft record is set to 0", async (assert) => { await openView({ res_model: "res.partner", views: [[false, "form"]] }); await contains(".o-mail-Followers", { text: "0" }); }); + +QUnit.test("Mentions in composer should still work when using pager", async () => { + const pyEnv = await startServer(); + const [partnerId_1, partnerId_2] = pyEnv["res.partner"].create([ + { display_name: "Partner 1" }, + { display_name: "Partner 2" }, + ]); + const views = { + "res.partner,false,form": ` +
+ + + +
+ +
+
`, + }; + patchUiSize({ size: SIZES.LG }); + const { openView } = await start({ serverData: { views } }); + await openView( + { + res_model: "res.partner", + res_id: partnerId_1, + views: [[false, "form"]], + }, + { resIds: [partnerId_1, partnerId_2] } + ); + + await click("button:contains(Log note)"); + await click(".o_pager_next"); + await insertText(".o-mail-Composer-input", "@"); + await contains(".o-mail-Composer-suggestion"); +});