The commit is to refactor the discuss sidebar - threads are now organized in categories based on the thread type e.g. chat, channel - categories can be folded or unfolded by clicking the category title - for active thread, even if the category is folded, it remains under the category title - for channel category, a new cog button is added to view all channels - the active indicator bar is removed. The active item now is highlighted with a different background color - thread avatar is used for livechat, chat and channel - for livechat and chat, threads are now sorted by last activity time (pin or message exchange) closes odoo/odoo#70986 Task-id: 2440073 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
56 lines
2.4 KiB
Python
56 lines
2.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.addons.mail.tests.common import MailCommon
|
|
from odoo.tests.common import users
|
|
|
|
|
|
class TestResUsersSettings(MailCommon):
|
|
|
|
@users('employee')
|
|
def test_find_or_create_for_user_should_create_record_if_not_existing(self):
|
|
settings = self.user_employee.res_users_settings_ids
|
|
self.assertFalse(settings, "no records should exist")
|
|
|
|
self.env['res.users.settings']._find_or_create_for_user(self.user_employee)
|
|
settings = self.user_employee.res_users_settings_ids
|
|
self.assertTrue(settings, "a record should be created after _find_or_create_for_user is called")
|
|
|
|
@users('employee')
|
|
def test_find_or_create_for_user_should_return_correct_res_users_settings(self):
|
|
settings = self.env['res.users.settings'].create({
|
|
'user_id': self.user_employee.id,
|
|
})
|
|
result = self.env['res.users.settings']._find_or_create_for_user(self.user_employee)
|
|
self.assertEqual(result, settings, "Correct mail user settings should be returned")
|
|
|
|
@users('employee')
|
|
def test_set_res_users_settings_should_send_notification_on_bus(self):
|
|
settings = self.env['res.users.settings'].create({
|
|
'is_discuss_sidebar_category_channel_open': False,
|
|
'is_discuss_sidebar_category_chat_open': False,
|
|
'user_id': self.user_employee.id,
|
|
})
|
|
|
|
with self.assertBus(
|
|
[(self.cr.dbname, 'res.partner', self.partner_employee.id)],
|
|
[{
|
|
"type": "res.users_settings_changed",
|
|
"payload": {"is_discuss_sidebar_category_chat_open": True}
|
|
}]):
|
|
settings.set_res_users_settings({'is_discuss_sidebar_category_chat_open': True})
|
|
|
|
@users('employee')
|
|
def test_set_res_users_settings_should_set_settings_properly(self):
|
|
settings = self.env['res.users.settings'].create({
|
|
'is_discuss_sidebar_category_channel_open': False,
|
|
'is_discuss_sidebar_category_chat_open': False,
|
|
'user_id': self.user_employee.id,
|
|
})
|
|
settings.set_res_users_settings({'is_discuss_sidebar_category_chat_open': True})
|
|
self.assertEqual(
|
|
settings.is_discuss_sidebar_category_chat_open,
|
|
True,
|
|
"category state should be updated correctly"
|
|
)
|