From f71484fdae86e27b5315c2c020103f6305520eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Thu, 26 Aug 2021 15:27:21 +0000 Subject: [PATCH] [IMP] mail: remove thread rename from discuss sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit task-2628751 closes odoo/odoo#75659 Signed-off-by: Alexandre Kühn (aku) --- .../components/discuss/tests/discuss_tests.js | 84 ++----------------- .../discuss_sidebar_category_item.scss | 19 ----- .../discuss_sidebar_category_item.xml | 23 +---- .../mail/static/src/models/discuss/discuss.js | 25 ------ .../discuss_sidebar_category_item.js | 66 --------------- 5 files changed, 8 insertions(+), 209 deletions(-) diff --git a/addons/mail/static/src/components/discuss/tests/discuss_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_tests.js index d94b624ed81..6664b3fc4eb 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_tests.js @@ -636,7 +636,7 @@ QUnit.test('sidebar: public/private channel rendering', async function (assert) }); QUnit.test('sidebar: basic chat rendering', async function (assert) { - assert.expect(10); + assert.expect(9); // expected correspondent, with a random unique id that will be used to link // partner to chat and a random name that will be asserted in the test @@ -685,13 +685,8 @@ QUnit.test('sidebar: basic chat rendering', async function (assert) { ); assert.strictEqual( chat.querySelectorAll(`:scope .o_DiscussSidebarCategoryItem_command`).length, - 2, - "should have 2 commands" - ); - assert.strictEqual( - chat.querySelectorAll(`:scope .o_DiscussSidebarCategoryItem_commandRename`).length, 1, - "should have 'rename' command" + "should have 1 command" ); assert.strictEqual( chat.querySelectorAll(`:scope .o_DiscussSidebarCategoryItem_commandUnpin`).length, @@ -706,7 +701,7 @@ QUnit.test('sidebar: basic chat rendering', async function (assert) { }); QUnit.test('sidebar: chat rendering with unread counter', async function (assert) { - assert.expect(5); + assert.expect(4); // chat expected to be found in the sidebar this.data['mail.channel'].records.push({ @@ -729,13 +724,8 @@ QUnit.test('sidebar: chat rendering with unread counter', async function (assert ); assert.strictEqual( chat.querySelectorAll(`:scope .o_DiscussSidebarCategoryItem_command`).length, - 1, - "should have single command" - ); - assert.strictEqual( - chat.querySelectorAll(`:scope .o_DiscussSidebarCategoryItem_commandRename`).length, - 1, - "should have 'rename' command" + 0, + "should have no command" ); assert.strictEqual( chat.querySelectorAll(`:scope .o_DiscussSidebarCategoryItem_commandUnpin`).length, @@ -886,70 +876,6 @@ QUnit.test('sidebar: chat custom name', async function (assert) { ); }); -QUnit.test('sidebar: rename chat', async function (assert) { - assert.expect(8); - - // expected correspondent, with a random unique id that will be used to link - // partner to chat, and a random name not used in the scope of this test but set for consistency - this.data['res.partner'].records.push({ id: 101, name: "Marc Demo" }); - // chat expected to be found in the sidebar - this.data['mail.channel'].records.push({ - channel_type: 'chat', // testing a chat is the goal of the test - custom_channel_name: "Marc", // testing a custom name is the goal of the test - members: [this.data.currentPartnerId, 101], // expected partners - public: 'private', // expected value for testing a chat - }); - await this.start(); - const chat = document.querySelector(`.o_DiscussSidebar_categoryChat .o_DiscussSidebarCategory_item`); - assert.strictEqual( - chat.querySelector(`:scope .o_DiscussSidebarCategoryItem_name`).textContent, - "Marc", - "chat should have custom name as name" - ); - assert.notOk( - chat.querySelector(`:scope .o_DiscussSidebarCategoryItem_name`).classList.contains('o-editable'), - "chat name should not be editable" - ); - - await afterNextRender(() => - chat.querySelector(`:scope .o_DiscussSidebarCategoryItem_commandRename`).click() - ); - assert.ok( - chat.querySelector(`:scope .o_DiscussSidebarCategoryItem_name`).classList.contains('o-editable'), - "chat should have editable name" - ); - assert.strictEqual( - chat.querySelectorAll(`:scope .o_DiscussSidebarCategoryItem_nameInput`).length, - 1, - "chat should have editable name input" - ); - assert.strictEqual( - chat.querySelector(`:scope .o_DiscussSidebarCategoryItem_nameInput`).value, - "Marc", - "editable name input should have custom chat name as value by default" - ); - assert.strictEqual( - chat.querySelector(`:scope .o_DiscussSidebarCategoryItem_nameInput`).placeholder, - "Marc Demo", - "editable name input should have partner name as placeholder" - ); - - await afterNextRender(() => { - chat.querySelector(`:scope .o_DiscussSidebarCategoryItem_nameInput`).value = "Demo"; - const kevt = new window.KeyboardEvent('keydown', { key: "Enter" }); - chat.querySelector(`:scope .o_DiscussSidebarCategoryItem_nameInput`).dispatchEvent(kevt); - }); - assert.notOk( - chat.querySelector(`:scope .o_DiscussSidebarCategoryItem_name`).classList.contains('o-editable'), - "chat should no longer show editable name" - ); - assert.strictEqual( - chat.querySelector(`:scope .o_DiscussSidebarCategoryItem_name`).textContent, - "Demo", - "chat should have renamed name as name" - ); -}); - QUnit.test('default thread rendering', async function (assert) { assert.expect(16); diff --git a/addons/mail/static/src/components/discuss_sidebar_category_item/discuss_sidebar_category_item.scss b/addons/mail/static/src/components/discuss_sidebar_category_item/discuss_sidebar_category_item.scss index f06ba7c83d6..93bb7556fcd 100644 --- a/addons/mail/static/src/components/discuss_sidebar_category_item/discuss_sidebar_category_item.scss +++ b/addons/mail/static/src/components/discuss_sidebar_category_item/discuss_sidebar_category_item.scss @@ -56,19 +56,6 @@ } } -.o_DiscussSidebarCategoryItem_name { - @include text-truncate(); - margin-left: 10px; - - &.o-editable { - margin-right: $o-mail-discuss-sidebar-scrollbar-width; - } -} - -.o_DiscussSidebarCategoryItem_nameInput { - width: 100%; -} - .o_DiscussSidebarCategoryItem_threadIcon { @include o-position-absolute($bottom: 0, $right: 0); @@ -117,9 +104,3 @@ font-weight: bold; } } - -.o_DiscussSidebarCategoryItem_nameInput{ - outline: none; - border: none; - border-radius: 2px; -} diff --git a/addons/mail/static/src/components/discuss_sidebar_category_item/discuss_sidebar_category_item.xml b/addons/mail/static/src/components/discuss_sidebar_category_item/discuss_sidebar_category_item.xml index 48bbedc780c..9b73002e15d 100644 --- a/addons/mail/static/src/components/discuss_sidebar_category_item/discuss_sidebar_category_item.xml +++ b/addons/mail/static/src/components/discuss_sidebar_category_item/discuss_sidebar_category_item.xml @@ -15,23 +15,9 @@ - - - - - - - - - - + + +
@@ -40,9 +26,6 @@