[FIX] mail, test_discuss_full: add guests name into group dm name
Before this commit: In discuss, the group DM default name does not contain any guest names in it. After this commit: Group DM default name will also take guest names along with other user names. Task-2664859 closes odoo/odoo#86130 X-original-commit: 41f4c5741097b09c372406bbbd5364314bff6d1b Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
@@ -193,6 +193,13 @@ msgstr ""
|
||||
msgid "(originally assigned to"
|
||||
msgstr ""
|
||||
|
||||
#. module: mail
|
||||
#. openerp-web
|
||||
#: code:addons/mail/static/src/models/thread/thread.js:0
|
||||
#, python-format
|
||||
msgid ", "
|
||||
msgstr ""
|
||||
|
||||
#. module: mail
|
||||
#. openerp-web
|
||||
#: code:addons/mail/static/src/components/composer/composer.xml:0
|
||||
|
||||
@@ -794,6 +794,10 @@ class Channel(models.Model):
|
||||
'fetched_message_id': cp.fetched_message_id.id,
|
||||
'seen_message_id': cp.seen_message_id.id,
|
||||
} for cp in members_by_channel[channel] if cp.partner_id], key=lambda p: p['partner_id'])
|
||||
info['guestMembers'] = [('insert', sorted([{
|
||||
'id': member.guest_id.id,
|
||||
'name': member.guest_id.name,
|
||||
} for member in members_by_channel[channel] if member.guest_id], key=lambda g: g['id']))]
|
||||
|
||||
# add RTC sessions info
|
||||
info.update({
|
||||
|
||||
@@ -164,6 +164,9 @@ registerModel({
|
||||
if ('group_based_subscription' in data) {
|
||||
data2.group_based_subscription = data.group_based_subscription;
|
||||
}
|
||||
if ('guestMembers' in data) {
|
||||
data2.guestMembers = data.guestMembers;
|
||||
}
|
||||
if ('id' in data) {
|
||||
data2.id = data.id;
|
||||
}
|
||||
@@ -1231,8 +1234,10 @@ registerModel({
|
||||
if (this.channel_type === 'chat' && this.correspondent) {
|
||||
return this.custom_channel_name || this.correspondent.nameOrDisplayName;
|
||||
}
|
||||
if (this.channel_type === 'group') {
|
||||
return this.name || this.members.map(partner => partner.nameOrDisplayName).join(', ');
|
||||
if (this.channel_type === 'group' && !this.name) {
|
||||
const partnerNames = this.members.map(partner => partner.nameOrDisplayName);
|
||||
const guestNames = this.guestMembers.map(guest => guest.name);
|
||||
return [...partnerNames, ...guestNames].join(this.env._t(", "));
|
||||
}
|
||||
return this.name;
|
||||
},
|
||||
@@ -1781,6 +1786,26 @@ registerModel({
|
||||
},
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {Array[]}
|
||||
*/
|
||||
_sortGuestMembers() {
|
||||
return [
|
||||
['defined-first', 'name'],
|
||||
['case-insensitive-asc', 'name'],
|
||||
];
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {Array[]}
|
||||
*/
|
||||
_sortPartnerMembers() {
|
||||
return [
|
||||
['defined-first', 'nameOrDisplayName'],
|
||||
['case-insensitive-asc', 'nameOrDisplayName'],
|
||||
];
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @param {Partner[]} members
|
||||
@@ -1949,7 +1974,9 @@ registerModel({
|
||||
group_based_subscription: attr({
|
||||
default: false,
|
||||
}),
|
||||
guestMembers: many('Guest'),
|
||||
guestMembers: many('Guest', {
|
||||
sort: '_sortGuestMembers',
|
||||
}),
|
||||
/**
|
||||
* States whether `this` has activities (`mail.activity.mixin` server side).
|
||||
*/
|
||||
@@ -2119,6 +2146,7 @@ registerModel({
|
||||
memberCount: attr(),
|
||||
members: many('Partner', {
|
||||
inverse: 'memberThreads',
|
||||
sort: '_sortPartnerMembers',
|
||||
}),
|
||||
/**
|
||||
* Determines the last mentioned channels of the last composer related
|
||||
|
||||
@@ -289,6 +289,7 @@ class TestDiscussFullPerformance(TransactionCase):
|
||||
'defaultDisplayMode': False,
|
||||
'description': False,
|
||||
'group_based_subscription': False,
|
||||
'guestMembers': [('insert', [])],
|
||||
'id': channel_group_1.id,
|
||||
'invitedGuests': [('insert', [])],
|
||||
'invitedPartners': [('insert', [])],
|
||||
@@ -352,6 +353,7 @@ class TestDiscussFullPerformance(TransactionCase):
|
||||
'defaultDisplayMode': False,
|
||||
'description': False,
|
||||
'group_based_subscription': False,
|
||||
'guestMembers': [('insert', [])],
|
||||
'id': channel_chat_1.id,
|
||||
'invitedGuests': [('insert', [])],
|
||||
'invitedPartners': [('insert', [])],
|
||||
@@ -415,6 +417,7 @@ class TestDiscussFullPerformance(TransactionCase):
|
||||
'defaultDisplayMode': False,
|
||||
'description': False,
|
||||
'group_based_subscription': False,
|
||||
'guestMembers': [('insert', [])],
|
||||
'id': channel_chat_2.id,
|
||||
'invitedGuests': [('insert', [])],
|
||||
'invitedPartners': [('insert', [])],
|
||||
@@ -478,6 +481,7 @@ class TestDiscussFullPerformance(TransactionCase):
|
||||
'defaultDisplayMode': False,
|
||||
'description': False,
|
||||
'group_based_subscription': False,
|
||||
'guestMembers': [('insert', [])],
|
||||
'id': channel_chat_3.id,
|
||||
'invitedGuests': [('insert', [])],
|
||||
'invitedPartners': [('insert', [])],
|
||||
@@ -541,6 +545,7 @@ class TestDiscussFullPerformance(TransactionCase):
|
||||
'defaultDisplayMode': False,
|
||||
'description': False,
|
||||
'group_based_subscription': False,
|
||||
'guestMembers': [('insert', [])],
|
||||
'id': channel_chat_4.id,
|
||||
'invitedGuests': [('insert', [])],
|
||||
'invitedPartners': [('insert', [])],
|
||||
@@ -604,6 +609,7 @@ class TestDiscussFullPerformance(TransactionCase):
|
||||
'defaultDisplayMode': False,
|
||||
'description': False,
|
||||
'group_based_subscription': False,
|
||||
'guestMembers': [('insert', [])],
|
||||
'id': channel_livechat_1.id,
|
||||
'invitedGuests': [('insert', [])],
|
||||
'invitedPartners': [('insert', [])],
|
||||
@@ -667,6 +673,7 @@ class TestDiscussFullPerformance(TransactionCase):
|
||||
'defaultDisplayMode': False,
|
||||
'description': False,
|
||||
'group_based_subscription': False,
|
||||
'guestMembers': [('insert', [])],
|
||||
'id': channel_livechat_2.id,
|
||||
'invitedGuests': [('insert', [])],
|
||||
'invitedPartners': [('insert', [])],
|
||||
|
||||
Reference in New Issue
Block a user