[IMP] mail, *: tests: remove fake mail.channel/members field
*: hr_holidays, im_livechat, website_livechat Task-2810539 closes odoo/odoo#87599 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -32,7 +32,7 @@ QUnit.test('thread icon of a chat when correspondent is on leave & online', asyn
|
||||
this.data['mail.channel'].records.push({
|
||||
channel_type: 'chat',
|
||||
id: 20,
|
||||
members: [this.data.currentPartnerId, 7],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 7],
|
||||
});
|
||||
const { messaging, widget } = await start({ data: this.data });
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
@@ -64,7 +64,7 @@ QUnit.test('thread icon of a chat when correspondent is on leave & away', async
|
||||
this.data['mail.channel'].records.push({
|
||||
channel_type: 'chat',
|
||||
id: 20,
|
||||
members: [this.data.currentPartnerId, 7],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 7],
|
||||
});
|
||||
const { messaging, widget } = await start({ data: this.data });
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
@@ -96,7 +96,7 @@ QUnit.test('thread icon of a chat when correspondent is on leave & offline', asy
|
||||
this.data['mail.channel'].records.push({
|
||||
channel_type: 'chat',
|
||||
id: 20,
|
||||
members: [this.data.currentPartnerId, 7],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 7],
|
||||
});
|
||||
const { messaging, widget } = await start({ data: this.data });
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
|
||||
@@ -28,7 +28,7 @@ QUnit.test('out of office message on direct chat with out of office partner', as
|
||||
this.data['mail.channel'].records = [{
|
||||
channel_type: 'chat',
|
||||
id: 20,
|
||||
members: [this.data.currentPartnerId, 11],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 11],
|
||||
}];
|
||||
const { createThreadViewComponent, messaging } = await start({ data: this.data });
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
|
||||
@@ -97,7 +97,7 @@ MockServer.include({
|
||||
// remove active test to ensure public partner is taken into account
|
||||
let members = this._getRecords(
|
||||
'res.partner',
|
||||
[['id', 'in', mailChannel.members]],
|
||||
[['id', 'in', mailChannel.channel_partner_ids]],
|
||||
{ active_test: false },
|
||||
);
|
||||
members = members.filter(member => member.id !== mailChannel.livechat_operator_id);
|
||||
@@ -163,17 +163,17 @@ MockServer.include({
|
||||
_mockImLivechatChannel_getLivechatMailChannelVals(id, anonymous_name, operator, user_id, country_id) {
|
||||
// partner to add to the mail.channel
|
||||
const operator_partner_id = operator.partner_id;
|
||||
const members = [[4, operator_partner_id]];
|
||||
const channel_partner_ids = [[4, operator_partner_id]];
|
||||
let visitor_user;
|
||||
if (user_id) {
|
||||
const visitor_user = this._getRecords('res.users', [['id', '=', user_id]])[0];
|
||||
if (visitor_user && visitor_user.active) {
|
||||
// valid session user (not public)
|
||||
members.push([4, visitor_user.partner_id.id]);
|
||||
channel_partner_ids.push([4, visitor_user.partner_id.id]);
|
||||
}
|
||||
} else {
|
||||
// for simplicity of not having mocked channel.partner, add public partner here
|
||||
members.push([4, this.publicPartnerId]);
|
||||
channel_partner_ids.push([4, this.publicPartnerId]);
|
||||
}
|
||||
const membersName = [
|
||||
visitor_user ? visitor_user.display_name : anonymous_name,
|
||||
@@ -186,7 +186,7 @@ MockServer.include({
|
||||
// defaults that would set it to true) and here operator and visitor
|
||||
// can't be differentiated in that regard.
|
||||
'is_pinned': false,
|
||||
'members': members, // channel_partner_ids
|
||||
'channel_partner_ids': channel_partner_ids,
|
||||
'livechat_active': true,
|
||||
'livechat_operator_id': operator_partner_id,
|
||||
'livechat_channel_id': id,
|
||||
@@ -247,7 +247,7 @@ MockServer.include({
|
||||
const livechats = this._getRecords('mail.channel', [
|
||||
['channel_type', '=', 'livechat'],
|
||||
['is_pinned', '=', true],
|
||||
['members', 'in', partner.id],
|
||||
['channel_partner_ids', 'in', partner.id],
|
||||
]);
|
||||
return [
|
||||
...this._super(ids),
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ QUnit.test('closing a chat window with no message from admin side unpins it', as
|
||||
channel_type: "livechat",
|
||||
id: 10,
|
||||
is_pinned: true,
|
||||
members: [this.data.currentPartnerId, 10],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 10],
|
||||
uuid: 'channel-10-uuid',
|
||||
},
|
||||
);
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ QUnit.test('livechat - avatar: should have a smiley face avatar for an anonymous
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.currentPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.currentPartnerId],
|
||||
});
|
||||
const { messaging } = await this.start();
|
||||
|
||||
@@ -64,7 +64,7 @@ QUnit.test('livechat - avatar: should have a partner profile picture for a livec
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, 10],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 10],
|
||||
});
|
||||
const { messaging } = await this.start();
|
||||
|
||||
|
||||
+12
-12
@@ -30,7 +30,7 @@ QUnit.test('livechat - counter: should not have a counter if the category is unf
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
await this.start();
|
||||
assert.containsNone(
|
||||
@@ -48,7 +48,7 @@ QUnit.test('livechat - counter: should not have a counter if the category is unf
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
message_unread_counter: 10,
|
||||
});
|
||||
await this.start();
|
||||
@@ -67,7 +67,7 @@ QUnit.test('livechat - counter: should not have a counter if category is folded
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
this.data['res.users.settings'].records.push({
|
||||
user_id: this.data.currentUserId,
|
||||
@@ -90,7 +90,7 @@ QUnit.test('livechat - counter: should have correct value of unread threads if c
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
message_unread_counter: 10,
|
||||
});
|
||||
this.data['res.users.settings'].records.push({
|
||||
@@ -114,7 +114,7 @@ QUnit.test('livechat - states: close manually by clicking the title', async func
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
this.data['res.users.settings'].records.push({
|
||||
user_id: this.data.currentUserId,
|
||||
@@ -159,7 +159,7 @@ QUnit.test('livechat - states: open manually by clicking the title', async funct
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
this.data['res.users.settings'].records.push({
|
||||
user_id: this.data.currentUserId,
|
||||
@@ -204,7 +204,7 @@ QUnit.test('livechat - states: close should update the value on the server', asy
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
this.data['res.users.settings'].records.push({
|
||||
user_id: this.data.currentUserId,
|
||||
@@ -250,7 +250,7 @@ QUnit.test('livechat - states: open should update the value on the server', asyn
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
this.data['res.users.settings'].records.push({
|
||||
user_id: this.data.currentUserId,
|
||||
@@ -296,7 +296,7 @@ QUnit.test('livechat - states: close from the bus', async function (assert) {
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
const { env, messaging } = await this.start();
|
||||
|
||||
@@ -338,7 +338,7 @@ QUnit.test('livechat - states: open from the bus', async function (assert) {
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
this.data['res.users.settings'].records.push({
|
||||
user_id: this.data.currentUserId,
|
||||
@@ -385,7 +385,7 @@ QUnit.test('livechat - states: category item should be invisible if the catgory
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
const { messaging } = await this.start();
|
||||
|
||||
@@ -426,7 +426,7 @@ QUnit.test('livechat - states: the active category item should be visble even if
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
const { messaging } = await this.start();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ QUnit.test('livechat in the sidebar: basic rendering', async function (assert) {
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
const { messaging } = await start({
|
||||
autoOpenDiscuss: true,
|
||||
@@ -81,7 +81,7 @@ QUnit.test('livechat in the sidebar: existing user with country', async function
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, 10],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 10],
|
||||
});
|
||||
await start({
|
||||
autoOpenDiscuss: true,
|
||||
@@ -162,7 +162,7 @@ QUnit.test('do not add livechat in the sidebar on visitor typing', async functio
|
||||
is_pinned: false,
|
||||
livechat_channel_id: 10,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.publicPartnerId, this.data.currentPartnerId],
|
||||
channel_partner_ids: [this.data.publicPartnerId, this.data.currentPartnerId],
|
||||
});
|
||||
const { env } = await start({
|
||||
autoOpenDiscuss: true,
|
||||
@@ -219,7 +219,7 @@ QUnit.test('add livechat in the sidebar on visitor sending first message', async
|
||||
is_pinned: false,
|
||||
livechat_channel_id: 10,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.publicPartnerId, this.data.currentPartnerId],
|
||||
channel_partner_ids: [this.data.publicPartnerId, this.data.currentPartnerId],
|
||||
});
|
||||
const { env } = await start({
|
||||
autoOpenDiscuss: true,
|
||||
@@ -270,7 +270,7 @@ QUnit.test('livechats are sorted by last activity time in the sidebar: most rece
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
last_interest_dt: datetime_to_str(new Date(2021, 0, 1)), // less recent one
|
||||
},
|
||||
{
|
||||
@@ -278,7 +278,7 @@ QUnit.test('livechats are sorted by last activity time in the sidebar: most rece
|
||||
channel_type: 'livechat',
|
||||
id: 12,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
last_interest_dt: datetime_to_str(new Date(2021, 0, 2)), // more recent one
|
||||
},
|
||||
);
|
||||
@@ -344,7 +344,7 @@ QUnit.test('invite button should be present on livechat', async function (assert
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
},
|
||||
);
|
||||
await start({
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ QUnit.test('livechats should be in "chat" filter', async function (assert) {
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
const { createMessagingMenuComponent, messaging } = await start({ data: this.data });
|
||||
await createMessagingMenuComponent();
|
||||
|
||||
@@ -30,7 +30,7 @@ QUnit.test('livechat: public website visitor is typing', async function (assert)
|
||||
channel_type: 'livechat',
|
||||
id: 20,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
const { messaging, widget } = await start({ data: this.data });
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ QUnit.test('receive visitor typing status "is typing"', async function (assert)
|
||||
channel_type: 'livechat',
|
||||
id: 20,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
const { messaging, widget } = await start({ data: this.data });
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
|
||||
@@ -694,14 +694,14 @@ MockServer.include({
|
||||
*/
|
||||
_mockMailChannelActionUnfollow(ids) {
|
||||
const channel = this._getRecords('mail.channel', [['id', 'in', ids]])[0];
|
||||
if (!channel.members.includes(this.currentPartnerId)) {
|
||||
if (!channel.channel_partner_ids.includes(this.currentPartnerId)) {
|
||||
return true;
|
||||
}
|
||||
this._mockWrite('mail.channel', [
|
||||
[channel.id],
|
||||
{
|
||||
is_pinned: false,
|
||||
members: [[3, this.currentPartnerId]],
|
||||
channel_partner_ids: [[3, this.currentPartnerId]],
|
||||
},
|
||||
]);
|
||||
this._widget.call('bus_service', 'trigger', 'notification', [{
|
||||
@@ -917,7 +917,7 @@ MockServer.include({
|
||||
is_minimized: true,
|
||||
is_pinned: true,
|
||||
last_interest_dt: datetime_to_str(new Date()),
|
||||
members: [[6, 0, partners_to]],
|
||||
channel_partner_ids: [[6, 0, partners_to]],
|
||||
name: partners.map(partner => partner.name).join(", "),
|
||||
public: 'private',
|
||||
state: 'open',
|
||||
@@ -934,17 +934,17 @@ MockServer.include({
|
||||
_mockMailChannelChannelInfo(ids) {
|
||||
const channels = this._getRecords('mail.channel', [['id', 'in', ids]]);
|
||||
const all_partners = [...new Set(channels.reduce((all_partners, channel) => {
|
||||
return [...all_partners, ...channel.members];
|
||||
return [...all_partners, ...channel.channel_partner_ids];
|
||||
}, []))];
|
||||
const direct_partners = [...new Set(channels.reduce((all_partners, channel) => {
|
||||
if (channel.channel_type === 'chat') {
|
||||
return [...all_partners, ...channel.members];
|
||||
return [...all_partners, ...channel.channel_partner_ids];
|
||||
}
|
||||
return all_partners;
|
||||
}, []))];
|
||||
const partnerInfos = this._mockMailChannelPartnerInfo(all_partners, direct_partners);
|
||||
return channels.map(channel => {
|
||||
const members = channel.members.map(partnerId => partnerInfos[partnerId]);
|
||||
const members = channel.channel_partner_ids.map(partnerId => partnerInfos[partnerId]);
|
||||
const messages = this._getRecords('mail.message', [
|
||||
['model', '=', 'mail.channel'],
|
||||
['res_id', '=', channel.id],
|
||||
@@ -1092,7 +1092,7 @@ MockServer.include({
|
||||
const id = this._mockCreate('mail.channel', {
|
||||
channel_type: 'group',
|
||||
is_pinned: true,
|
||||
members: [[6, 0, partners.map(partner => partner.id)]],
|
||||
channel_partner_ids: [[6, 0, partners.map(partner => partner.id)]],
|
||||
name: '',
|
||||
public: 'private',
|
||||
state: 'open',
|
||||
@@ -1122,7 +1122,7 @@ MockServer.include({
|
||||
const ids = args.args[0];
|
||||
const channels = this._getRecords('mail.channel', [['id', 'in', ids]]);
|
||||
for (const channel of channels) {
|
||||
const members = channel.members.map(memberId => this._getRecords('res.partner', [['id', '=', memberId]])[0].name);
|
||||
const members = channel.channel_partner_ids.map(memberId => this._getRecords('res.partner', [['id', '=', memberId]])[0].name);
|
||||
let message = "You are alone in this channel.";
|
||||
if (members.length > 0) {
|
||||
message = `Users in this channel: ${members.join(', ')} and you`;
|
||||
@@ -2078,12 +2078,12 @@ MockServer.include({
|
||||
const partner = this._getRecords('res.partner', [['id', 'in', ids]])[0];
|
||||
const channels = this._getRecords('mail.channel', [
|
||||
['channel_type', 'in', ['channel', 'group']],
|
||||
['members', 'in', partner.id],
|
||||
['channel_partner_ids', 'in', partner.id],
|
||||
]);
|
||||
const directMessages = this._getRecords('mail.channel', [
|
||||
['channel_type', '=', 'chat'],
|
||||
['is_pinned', '=', true],
|
||||
['members', 'in', partner.id],
|
||||
['channel_partner_ids', 'in', partner.id],
|
||||
]);
|
||||
return [
|
||||
...channels,
|
||||
|
||||
@@ -44,6 +44,11 @@ insertModelFields('mail.channel', {
|
||||
},
|
||||
},
|
||||
avatarCacheKey: { string: "Avatar Cache Key", type: "datetime" },
|
||||
channel_partner_ids: {
|
||||
default() {
|
||||
return [this.currentPartnerId];
|
||||
},
|
||||
},
|
||||
channel_type: { default: 'channel' },
|
||||
custom_channel_name: { string: "Custom channel name", type: 'char' },
|
||||
fetched_message_id: { relation: 'mail.message', string: "Last Fetched", type: 'many2one' },
|
||||
@@ -51,14 +56,6 @@ insertModelFields('mail.channel', {
|
||||
is_minimized: { string: "isMinimized", type: "boolean" },
|
||||
is_pinned: { default: true, string: "isPinned", type: "boolean" },
|
||||
last_interest_dt: { string: "Last Interest", type: "datetime" },
|
||||
members: {
|
||||
default() {
|
||||
return [this.currentPartnerId];
|
||||
},
|
||||
relation: 'res.partner',
|
||||
string: "Members",
|
||||
type: 'many2many'
|
||||
},
|
||||
message_unread_counter: { string: 'Unread counter', type: 'integer' },
|
||||
seen_message_id: { relation: 'mail.message', string: "Last Seen", type: 'many2one' },
|
||||
state: { default: 'open', string: "FoldState", type: "char" },
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ QUnit.test('should display the channel invitation form after clicking on the inv
|
||||
pyEnv['res.users'].create({ partner_id: resPartnerId1 });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
public: 'private',
|
||||
});
|
||||
const { click } = await start({
|
||||
@@ -57,7 +57,7 @@ QUnit.test('should be able to search for a new user to invite from an existing c
|
||||
pyEnv['res.users'].create({ partner_id: resPartnerId2 });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
public: 'private',
|
||||
});
|
||||
const { click } = await start({
|
||||
@@ -94,7 +94,7 @@ QUnit.test('should be able to create a new group chat from an existing chat', as
|
||||
pyEnv['res.users'].create({ partner_id: resPartnerId2 });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
public: 'private',
|
||||
});
|
||||
const { click } = await start({
|
||||
|
||||
@@ -328,7 +328,7 @@ QUnit.test('new message chat window should close on selecting the user if chat w
|
||||
pyEnv['mail.channel'].create({
|
||||
channel_type: "chat",
|
||||
is_minimized: true,
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
name: "Partner 131",
|
||||
public: 'private',
|
||||
state: 'open',
|
||||
@@ -683,7 +683,7 @@ QUnit.test("Mobile: chat window shouldn't open automatically after receiving a n
|
||||
{
|
||||
channel_type: "chat",
|
||||
id: resPartnerId1,
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
uuid: 'channel-10-uuid',
|
||||
},
|
||||
];
|
||||
@@ -1217,7 +1217,7 @@ QUnit.test('open 2 folded chat windows: check shift operations are available', a
|
||||
channel_type: "chat",
|
||||
is_minimized: true,
|
||||
is_pinned: true,
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
state: 'folded',
|
||||
};
|
||||
pyEnv['mail.channel'].create([channel, chat]);
|
||||
@@ -2054,7 +2054,7 @@ QUnit.test('new message separator is shown in a chat window of a chat on receivi
|
||||
channel_type: "chat",
|
||||
is_minimized: true,
|
||||
is_pinned: false,
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
uuid: 'channel-10-uuid',
|
||||
});
|
||||
pyEnv['mail.message'].create({
|
||||
@@ -2101,7 +2101,7 @@ QUnit.test('new message separator is not shown in a chat window of a chat on rec
|
||||
const resUsersId1 = pyEnv['res.users'].create({ name: "Foreigner user", partner_id: resPartnerId1 });
|
||||
pyEnv['mail.channel'].create({
|
||||
channel_type: "chat",
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
uuid: 'channel-10-uuid',
|
||||
});
|
||||
const { env } = await this.start();
|
||||
@@ -2134,7 +2134,7 @@ QUnit.test('focusing a chat window of a chat should make new message separator d
|
||||
channel_type: "chat",
|
||||
is_minimized: true,
|
||||
is_pinned: false,
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
message_unread_counter: 0,
|
||||
uuid: 'channel-10-uuid',
|
||||
});
|
||||
@@ -2243,7 +2243,7 @@ QUnit.test('chat window should open when receiving a new DM', async function (as
|
||||
pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
is_pinned: false,
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
uuid: 'channel11uuid'
|
||||
});
|
||||
const { env } = await this.start();
|
||||
@@ -2276,7 +2276,7 @@ QUnit.test('chat window should remain folded when new message is received', asyn
|
||||
channel_type: "chat",
|
||||
is_minimized: true,
|
||||
is_pinned: false,
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
state: 'folded',
|
||||
uuid: 'channel-10-uuid',
|
||||
});
|
||||
|
||||
@@ -177,7 +177,7 @@ QUnit.test('composer text input placeholder should contain correspondent name wh
|
||||
const resPartnerId1 = pyEnv['res.partner'].create({ name: 'Marc Demo' });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
});
|
||||
const { createComposerComponent, messaging } = await start();
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ QUnit.test('chat - avatar: should have correct avatar', async function (assert)
|
||||
const resPartnerId1 = pyEnv['res.partner'].create({ name: "Demo", im_status: 'offline' });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
public: 'private',
|
||||
});
|
||||
const { messaging } = await start({
|
||||
|
||||
@@ -17,7 +17,7 @@ QUnit.test('sidebar find shows channels matching search term', async function (a
|
||||
const pyEnv = await startServer();
|
||||
pyEnv['mail.channel'].create({
|
||||
channel_type: 'channel',
|
||||
members: [],
|
||||
channel_partner_ids: [],
|
||||
name: 'test',
|
||||
public: 'public',
|
||||
});
|
||||
@@ -69,7 +69,7 @@ QUnit.test('sidebar find shows channels matching search term even when user is m
|
||||
const pyEnv = await startServer();
|
||||
pyEnv['mail.channel'].create({
|
||||
channel_type: 'channel',
|
||||
members: [pyEnv.currentPartnerId],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId],
|
||||
name: 'test',
|
||||
public: 'public',
|
||||
});
|
||||
|
||||
@@ -611,7 +611,7 @@ QUnit.test('sidebar: basic chat rendering', async function (assert) {
|
||||
const resPartnerId1 = pyEnv['res.partner'].create({ name: "Demo" });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat', // testing a chat is the goal of the test
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1], // expected partners
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1], // expected partners
|
||||
public: 'private', // expected value for testing a chat
|
||||
});
|
||||
const { messaging } = await this.start();
|
||||
@@ -711,17 +711,17 @@ QUnit.test('sidebar: chat im_status rendering', async function (assert) {
|
||||
const [mailChannelId1, mailChannelId2, mailChannelId3] = pyEnv['mail.channel'].create([
|
||||
{
|
||||
channel_type: 'chat', // testing a chat is the goal of the test
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1], // expected partners
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1], // expected partners
|
||||
public: 'private', // expected value for testing a chat
|
||||
},
|
||||
{
|
||||
channel_type: 'chat', // testing a chat is the goal of the test
|
||||
members: [pyEnv.currentPartnerId, resPartnerId2], // expected partners
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId2], // expected partners
|
||||
public: 'private', // expected value for testing a chat
|
||||
},
|
||||
{
|
||||
channel_type: 'chat', // testing a chat is the goal of the test
|
||||
members: [pyEnv.currentPartnerId, resPartnerId3], // expected partners
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId3], // expected partners
|
||||
public: 'private', // expected value for testing a chat
|
||||
}
|
||||
]);
|
||||
@@ -822,7 +822,7 @@ QUnit.test('sidebar: chat custom name', async function (assert) {
|
||||
pyEnv['mail.channel'].create({
|
||||
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: [pyEnv.currentPartnerId, resPartnerId1], // expected partners
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1], // expected partners
|
||||
public: 'private', // expected value for testing a chat
|
||||
});
|
||||
await this.start();
|
||||
@@ -2009,7 +2009,7 @@ QUnit.test('redirect to author (open chat)', async function (assert) {
|
||||
{ name: "General" },
|
||||
{
|
||||
channel_type: 'chat', // testing a chat is the goal of the test
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1], // expected partners
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1], // expected partners
|
||||
public: 'private', // expected value for testing a chat
|
||||
}
|
||||
]);
|
||||
@@ -3693,7 +3693,7 @@ QUnit.test('auto-focus composer on opening thread', async function (assert) {
|
||||
{ name: "General" },
|
||||
{
|
||||
channel_type: 'chat', // testing a chat is the goal of the test
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1], // expected partners
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1], // expected partners
|
||||
public: 'private', // expected value for testing a chat
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -251,7 +251,7 @@ QUnit.test("'channel_fetch' notification received is correctly handled", async f
|
||||
const resPartnerId1 = pyEnv['res.partner'].create({ display_name: "Recipient" });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
});
|
||||
const { createThreadViewComponent, messaging, widget } = await start();
|
||||
const currentPartner = messaging.models['Partner'].insert({
|
||||
@@ -313,7 +313,7 @@ QUnit.test("'channel_seen' notification received is correctly handled", async fu
|
||||
const resPartnerId1 = pyEnv['res.partner'].create({ display_name: "Recipient" });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
});
|
||||
const { createThreadViewComponent, messaging, widget } = await start();
|
||||
const currentPartner = messaging.models['Partner'].insert({
|
||||
@@ -374,7 +374,7 @@ QUnit.test("'channel_fetch' notification then 'channel_seen' received are corre
|
||||
const resPartnerId1 = pyEnv['res.partner'].create({ display_name: "Recipient" });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
});
|
||||
const { createThreadViewComponent, messaging, widget } = await start();
|
||||
const currentPartner = messaging.models['Partner'].insert({
|
||||
@@ -869,7 +869,7 @@ QUnit.test('open chat with author on avatar click should be disabled when curren
|
||||
pyEnv['res.users'].create({ partner_id: resPartnerId1 });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
public: 'private',
|
||||
});
|
||||
pyEnv['mail.message'].create({
|
||||
|
||||
@@ -30,7 +30,7 @@ QUnit.test('chat: correspondent is typing', async function (assert) {
|
||||
});
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: 'chat',
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
});
|
||||
const { messaging, widget } = await start();
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
|
||||
+5
-5
@@ -29,7 +29,7 @@ QUnit.test('receive other member typing status "is typing"', async function (ass
|
||||
this.data['res.partner'].records.push({ id: 17, name: 'Demo' });
|
||||
this.data['mail.channel'].records.push({
|
||||
id: 20,
|
||||
members: [this.data.currentPartnerId, 17],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 17],
|
||||
});
|
||||
const { messaging, widget } = await start({ data: this.data });
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
@@ -69,7 +69,7 @@ QUnit.test('receive other member typing status "is typing" then "no longer is ty
|
||||
this.data['res.partner'].records.push({ id: 17, name: 'Demo' });
|
||||
this.data['mail.channel'].records.push({
|
||||
id: 20,
|
||||
members: [this.data.currentPartnerId, 17],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 17],
|
||||
});
|
||||
const { messaging, widget } = await start({ data: this.data });
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
@@ -127,7 +127,7 @@ QUnit.test('assume other member typing status becomes "no longer is typing" afte
|
||||
this.data['res.partner'].records.push({ id: 17, name: 'Demo' });
|
||||
this.data['mail.channel'].records.push({
|
||||
id: 20,
|
||||
members: [this.data.currentPartnerId, 17],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 17],
|
||||
});
|
||||
const { env, messaging, widget } = await start({ data: this.data, hasTimeControl: true });
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
@@ -174,7 +174,7 @@ QUnit.test ('other member typing status "is typing" refreshes 60 seconds timer o
|
||||
this.data['res.partner'].records.push({ id: 17, name: 'Demo' });
|
||||
this.data['mail.channel'].records.push({
|
||||
id: 20,
|
||||
members: [this.data.currentPartnerId, 17],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 17],
|
||||
});
|
||||
const { env, messaging, widget } = await start({
|
||||
data: this.data,
|
||||
@@ -247,7 +247,7 @@ QUnit.test('receive several other members typing status "is typing"', async func
|
||||
);
|
||||
this.data['mail.channel'].records.push({
|
||||
id: 20,
|
||||
members: [this.data.currentPartnerId, 10, 11, 12],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 10, 11, 12],
|
||||
});
|
||||
const { messaging, widget } = await start({ data: this.data });
|
||||
const thread = messaging.models['Thread'].findFromIdentifyingData({
|
||||
|
||||
@@ -34,7 +34,7 @@ QUnit.test('dragover files on thread with composer', async function (assert) {
|
||||
this.data['mail.channel'].records.push({
|
||||
channel_type: 'channel',
|
||||
id: 100,
|
||||
members: [this.data.currentPartnerId, 9, 10],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 9, 10],
|
||||
name: "General",
|
||||
public: 'public',
|
||||
});
|
||||
@@ -83,7 +83,7 @@ QUnit.test('message list desc order', async function (assert) {
|
||||
this.data['mail.channel'].records.push({
|
||||
channel_type: 'channel',
|
||||
id: 100,
|
||||
members: [this.data.currentPartnerId, 9, 10],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 9, 10],
|
||||
name: "General",
|
||||
public: 'public',
|
||||
});
|
||||
@@ -182,7 +182,7 @@ QUnit.test('message list asc order', async function (assert) {
|
||||
this.data['mail.channel'].records.push({
|
||||
channel_type: 'channel',
|
||||
id: 100,
|
||||
members: [this.data.currentPartnerId, 9, 10],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 9, 10],
|
||||
name: "General",
|
||||
public: 'public',
|
||||
});
|
||||
@@ -270,7 +270,7 @@ QUnit.test('mark channel as fetched when a new message is loaded and as seen whe
|
||||
channel_type: 'chat',
|
||||
id: 100,
|
||||
is_pinned: true,
|
||||
members: [this.data.currentPartnerId, 10],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 10],
|
||||
});
|
||||
const { afterEvent, createThreadViewComponent, env, messaging } = await start({
|
||||
data: this.data,
|
||||
|
||||
@@ -96,7 +96,7 @@ QUnit.test('openChat: open existing chat for user', async function (assert) {
|
||||
pyEnv['res.users'].create({ partner_id: resPartnerId1 });
|
||||
const mailChannelId1 = pyEnv['mail.channel'].create({
|
||||
channel_type: "chat",
|
||||
members: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId, resPartnerId1],
|
||||
public: 'private',
|
||||
});
|
||||
const { messaging } = await start();
|
||||
|
||||
+2
-2
@@ -69,11 +69,11 @@ QUnit.module('mail', {}, function () {
|
||||
const pyEnv = await startServer();
|
||||
pyEnv['mail.channel'].create({
|
||||
name: "general",
|
||||
members: [pyEnv.currentPartnerId],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId],
|
||||
});
|
||||
pyEnv['mail.channel'].create({
|
||||
name: "project",
|
||||
members: [pyEnv.currentPartnerId],
|
||||
channel_partner_ids: [pyEnv.currentPartnerId],
|
||||
});
|
||||
const target = getFixture();
|
||||
await start({
|
||||
|
||||
@@ -64,7 +64,7 @@ MockServer.include({
|
||||
anonymous_name: visitor_name,
|
||||
channel_type: 'livechat',
|
||||
livechat_operator_id: this.currentPartnerId,
|
||||
members,
|
||||
channel_partner_ids: members,
|
||||
public: 'private',
|
||||
});
|
||||
// notify operator
|
||||
|
||||
@@ -34,7 +34,7 @@ QUnit.test('rendering of visitor banner', async function (assert) {
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
livechat_visitor_id: 11,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
await start({
|
||||
autoOpenDiscuss: true,
|
||||
@@ -134,7 +134,7 @@ QUnit.test('livechat with non-logged visitor should show visitor banner', async
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
livechat_visitor_id: 11,
|
||||
members: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
channel_partner_ids: [this.data.currentPartnerId, this.data.publicPartnerId],
|
||||
});
|
||||
await start({
|
||||
autoOpenDiscuss: true,
|
||||
@@ -179,7 +179,7 @@ QUnit.test('livechat with logged visitor should show visitor banner', async func
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
livechat_visitor_id: 11,
|
||||
members: [this.data.currentPartnerId, 12],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 12],
|
||||
});
|
||||
await start({
|
||||
autoOpenDiscuss: true,
|
||||
@@ -211,7 +211,7 @@ QUnit.test('livechat without visitor should not show visitor banner', async func
|
||||
channel_type: 'livechat',
|
||||
id: 11,
|
||||
livechat_operator_id: this.data.currentPartnerId,
|
||||
members: [this.data.currentPartnerId, 11],
|
||||
channel_partner_ids: [this.data.currentPartnerId, 11],
|
||||
});
|
||||
await start({
|
||||
autoOpenDiscuss: true,
|
||||
|
||||
Reference in New Issue
Block a user