', self.id, self.name)
- # post 'channel left' message as root since the partner just unsubscribed from the channel
- self.sudo().message_post(body=notification, subtype_xmlid="mail.mt_comment", author_id=partner.id)
+ notification = _('
', self.id, self.name)
+ # post 'channel left' message as root since the partner just unsubscribed from the channel
+ self.sudo().message_post(body=notification, subtype_xmlid="mail.mt_comment", author_id=partner.id)
return result
def _action_add_members(self, partners):
@@ -366,7 +364,6 @@ class Channel(models.Model):
"""
# get values from msg_vals or from message if msg_vals doen't exists
msg_sudo = message.sudo()
- mailing_channels = self.filtered('email_send')
message_type = msg_vals.get('message_type', 'email') if msg_vals else msg_sudo.message_type
pids = msg_vals.get('partner_ids', []) if msg_vals else msg_sudo.partner_ids.ids
@@ -374,40 +371,14 @@ class Channel(models.Model):
if message_type not in ('comment', 'email'):
return []
# notify only mailing lists or if mentioning recipients
- if not mailing_channels and not pids:
+ if not pids:
return []
email_from = tools.email_normalize(msg_vals.get('email_from') or msg_sudo.email_from)
author_id = msg_vals.get('author_id') or msg_sudo.author_id.id
recipients_data = []
- if mailing_channels:
- sql_query = """
- SELECT DISTINCT ON (partner.id) partner.id
- FROM res_partner partner
- LEFT JOIN mail_channel_partner mcp on partner.id = mcp.partner_id
- LEFT JOIN mail_channel channel on channel.id = mcp.channel_id
- LEFT JOIN res_users users on partner.id = users.partner_id
- WHERE (users.notification_type != 'inbox' or users.id IS NULL)
- AND (partner.email != %s or partner.email IS NULL)
- AND channel.id = ANY(%s)
- AND partner.id != ANY(%s)"""
- self.env.cr.execute(
- sql_query,
- (email_from, mailing_channels.ids, [author_id] if author_id else [], )
- )
- for partner_id, in self._cr.fetchall():
- # ocn_client: will add partners to recipient recipient_data. more ocn notifications. We neeed to filter them maybe
- recipients_data.append({
- 'id': partner_id,
- 'share': True,
- 'active': True,
- 'notif': 'email',
- 'type': 'channel_email',
- 'groups': []
- })
- remaining = [pid for pid in pids if pid not in [recipient['id'] for recipient in recipients_data]]
- if remaining:
+ if pids:
sql_query = """
SELECT DISTINCT ON (partner.id) partner.id,
partner.partner_share,
@@ -419,7 +390,7 @@ class Channel(models.Model):
AND partner.id = ANY(%s) AND partner.id != ANY(%s)"""
self.env.cr.execute(
sql_query,
- (email_from, remaining, [author_id] if author_id else [], )
+ (email_from, list(pids), [author_id] if author_id else [], )
)
for partner_id, partner_share, notif in self._cr.fetchall():
# ocn_client: will add partners to recipient recipient_data. more ocn notifications. We neeed to filter them maybe
@@ -460,17 +431,6 @@ class Channel(models.Model):
headers['X-Forge-To'] = list_to
return headers
- def _notify_email_recipient_values(self, recipient_ids):
- # Excluded Blacklisted
- whitelist = self.env['res.partner'].sudo().browse(recipient_ids).filtered(lambda p: not p.is_blacklisted)
- # real mailing list: multiple recipients (hidden by X-Forge-To)
- if self.alias_domain and self.alias_name:
- return {
- 'email_to': ','.join(formataddr((partner.name, partner.email_normalized)) for partner in whitelist if partner.email_normalized),
- 'recipient_ids': [],
- }
- return super(Channel, self)._notify_email_recipient_values(whitelist.ids)
-
def _notify_thread(self, message, msg_vals=False, **kwargs):
# link message to channel
rdata = super(Channel, self)._notify_thread(message, msg_vals=msg_vals, **kwargs)
@@ -610,7 +570,6 @@ class Channel(models.Model):
'is_minimized': False,
'channel_type': channel.channel_type,
'public': channel.public,
- 'mass_mailing': channel.email_send,
'group_based_subscription': bool(channel.group_ids),
'create_uid': channel.create_uid.id,
}
@@ -715,7 +674,6 @@ class Channel(models.Model):
'channel_partner_ids': [Command.link(partner_id) for partner_id in partners_to],
'public': 'private',
'channel_type': 'chat',
- 'email_send': False,
'name': ', '.join(self.env['res.partner'].sudo().browse(partners_to).mapped('name')),
})
channel._broadcast(partners_to)
@@ -918,7 +876,7 @@ class Channel(models.Model):
def channel_join_and_get_info(self):
self.ensure_one()
added = self.action_follow()
- if added and self.channel_type == 'channel' and not self.email_send:
+ if added and self.channel_type == 'channel':
notification = _('
@@ -66,7 +61,6 @@
class="o_Composer_coreMain"
t-att-class="{
'o-composer-is-compact': props.isCompact,
- 'o-composer-is-extended': composer.thread and composer.thread.mass_mailing,
}"
>
{
- document.querySelector(`.o_ComposerTextInput_textarea`).focus();
- document.execCommand('insertText', false, "test message");
- });
- assert.strictEqual(
- document.querySelector(`.o_ComposerTextInput_textarea`).value,
- "test message",
- "should have inserted text content in editable"
- );
-
- await afterNextRender(() => {
- document.querySelector(`.o_Composer_subjectInput`).focus();
- document.execCommand('insertText', false, "test subject");
- });
- assert.strictEqual(
- document.querySelector(`.o_Composer_subjectInput`).value,
- "test subject",
- "should have inserted text content in input"
- );
-
- // Send message
- await afterNextRender(() =>
- document.querySelector('.o_Composer_buttonSend').click()
- );
- assert.verifySteps(['message_post']);
- assert.strictEqual(
- document.querySelector(`.o_ComposerTextInput_textarea`).value,
- "",
- "should have no content in composer input after posting message"
- );
- assert.strictEqual(
- document.querySelector(`.o_Composer_subjectInput`).value,
- "",
- "should have no content in composer subject input after posting message"
- );
-});
-
QUnit.test('composer with thread typing notification status', async function (assert) {
assert.expect(2);
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 5ef65e15c60..6858974b896 100644
--- a/addons/mail/static/src/components/discuss/tests/discuss_tests.js
+++ b/addons/mail/static/src/components/discuss/tests/discuss_tests.js
@@ -559,18 +559,6 @@ QUnit.test('sidebar: channel rendering with needaction counter', async function
);
});
-QUnit.test('sidebar: mailing channel', async function (assert) {
- assert.expect(1);
-
- // channel that is expected to be in the sidebar, with proper mass_mailing value
- this.data['mail.channel'].records.push({ mass_mailing: true });
- await this.start();
- assert.containsOnce(
- document.querySelector(`.o_DiscussSidebar_groupChannel .o_DiscussSidebar_item`),
- '.fa.fa-envelope-o',
- "should have an icon to indicate that the channel is a mailing channel"
- );
-});
QUnit.test('sidebar: public/private channel rendering', async function (assert) {
assert.expect(5);
@@ -2882,12 +2870,12 @@ QUnit.test('post a simple message', async function (assert) {
);
});
-QUnit.test('post message on non-mailing channel with "Enter" keyboard shortcut', async function (assert) {
+QUnit.test('post message on channel with "Enter" keyboard shortcut', async function (assert) {
assert.expect(2);
// channel expected to be found in the sidebar
// with a random unique id that will be referenced in the test
- this.data['mail.channel'].records.push({ id: 20, mass_mailing: false });
+ this.data['mail.channel'].records.push({ id: 20 });
await this.start({
discuss: {
params: {
@@ -2917,7 +2905,7 @@ QUnit.test('post message on non-mailing channel with "Enter" keyboard shortcut',
);
});
-QUnit.test('do not post message on non-mailing channel with "SHIFT-Enter" keyboard shortcut', async function (assert) {
+QUnit.test('do not post message on channel with "SHIFT-Enter" keyboard shortcut', async function (assert) {
// Note that test doesn't assert SHIFT-Enter makes a newline, because this
// default browser cannot be simulated with just dispatching
// programmatically crafted events...
@@ -2925,7 +2913,7 @@ QUnit.test('do not post message on non-mailing channel with "SHIFT-Enter" keyboa
// channel expected to be found in the sidebar
// with a random unique id that will be referenced in the test
- this.data['mail.channel'].records.push({ id: 20, mass_mailing: true });
+ this.data['mail.channel'].records.push({ id: 20 });
await this.start({
discuss: {
params: {
@@ -2953,114 +2941,6 @@ QUnit.test('do not post message on non-mailing channel with "SHIFT-Enter" keyboa
"should still not have any message in channel after pressing 'Shift-Enter' in text input of composer"
);
});
-
-QUnit.test('post message on mailing channel with "CTRL-Enter" keyboard shortcut', async function (assert) {
- assert.expect(2);
-
- // channel expected to be found in the sidebar
- // with a random unique id that will be referenced in the test
- this.data['mail.channel'].records.push({ id: 20, mass_mailing: true });
- await this.start({
- discuss: {
- params: {
- default_active_id: 'mail.channel_20',
- },
- },
- });
- assert.containsNone(
- document.body,
- '.o_Message',
- "should not have any message initially in channel"
- );
-
- // insert some HTML in editable
- await afterNextRender(() => {
- document.querySelector(`.o_ComposerTextInput_textarea`).focus();
- document.execCommand('insertText', false, "Test");
- });
- await afterNextRender(() => {
- const kevt = new window.KeyboardEvent('keydown', { ctrlKey: true, key: "Enter" });
- document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt);
- });
- assert.containsOnce(
- document.body,
- '.o_Message',
- "should now have single message in channel after posting message from pressing 'CTRL-Enter' in text input of composer"
- );
-});
-
-QUnit.test('post message on mailing channel with "META-Enter" keyboard shortcut', async function (assert) {
- assert.expect(2);
-
- // channel expected to be found in the sidebar
- // with a random unique id that will be referenced in the test
- this.data['mail.channel'].records.push({ id: 20, mass_mailing: true });
- await this.start({
- discuss: {
- params: {
- default_active_id: 'mail.channel_20',
- },
- },
- });
- assert.containsNone(
- document.body,
- '.o_Message',
- "should not have any message initially in channel"
- );
-
- // insert some HTML in editable
- await afterNextRender(() => {
- document.querySelector(`.o_ComposerTextInput_textarea`).focus();
- document.execCommand('insertText', false, "Test");
- });
- await afterNextRender(() => {
- const kevt = new window.KeyboardEvent('keydown', { key: "Enter", metaKey: true });
- document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt);
- });
- assert.containsOnce(
- document.body,
- '.o_Message',
- "should now have single message in channel after posting message from pressing 'META-Enter' in text input of composer"
- );
-});
-
-QUnit.test('do not post message on mailing channel with "Enter" keyboard shortcut', async function (assert) {
- // Note that test doesn't assert Enter makes a newline, because this
- // default browser cannot be simulated with just dispatching
- // programmatically crafted events...
- assert.expect(2);
-
- // channel expected to be found in the sidebar
- // with a random unique id that will be referenced in the test
- this.data['mail.channel'].records.push({ id: 20, mass_mailing: true });
- await this.start({
- discuss: {
- params: {
- default_active_id: 'mail.channel_20',
- },
- },
- });
- assert.containsNone(
- document.body,
- '.o_Message',
- "should not have any message initially in mailing channel"
- );
-
- // insert some HTML in editable
- await afterNextRender(() => {
- document.querySelector(`.o_ComposerTextInput_textarea`).focus();
- document.execCommand('insertText', false, "Test");
- });
- const kevt = new window.KeyboardEvent('keydown', { key: "Enter" });
- document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt);
- await nextAnimationFrame();
- assert.containsNone(
- document.body,
- '.o_Message',
- "should still not have any message in mailing channel after pressing 'Enter' in text input of composer"
- );
-});
-
QUnit.test('rendering of inbox message', async function (assert) {
// AKU TODO: kinda message specific test
assert.expect(7);
diff --git a/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.js b/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.js
index 72164ca71cb..2d915fa563a 100644
--- a/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.js
+++ b/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.js
@@ -35,7 +35,6 @@ export class DiscussSidebarItem extends Component {
threadDisplayName: thread && thread.displayName,
threadGroupBasedSubscription: thread && thread.group_based_subscription,
threadLocalMessageUnreadCounter: thread && thread.localMessageUnreadCounter,
- threadMassMailing: thread && thread.mass_mailing,
threadMessageNeedactionCounter: thread && thread.message_needaction_counter,
threadModel: thread && thread.model,
};
diff --git a/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.xml b/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.xml
index 74aace2181b..8158e4fc838 100644
--- a/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.xml
+++ b/addons/mail/static/src/components/discuss_sidebar_item/discuss_sidebar_item.xml
@@ -28,9 +28,6 @@
-
-
-
diff --git a/addons/mail/static/src/components/thread_view/thread_view.xml b/addons/mail/static/src/components/thread_view/thread_view.xml
index a4706ca6223..4fcebff1681 100644
--- a/addons/mail/static/src/components/thread_view/thread_view.xml
+++ b/addons/mail/static/src/components/thread_view/thread_view.xml
@@ -43,7 +43,6 @@
hasCurrentPartnerAvatar="props.hasComposerCurrentPartnerAvatar"
hasSendButton="props.hasComposerSendButton"
hasThreadTyping="props.hasComposerThreadTyping"
- isCompact="(threadView.thread.model === 'mail.channel' and threadView.thread.mass_mailing) ? false : undefined"
isDoFocus="props.isDoFocus"
showAttachmentsExtensions="props.showComposerAttachmentsExtensions"
showAttachmentsFilenames="props.showComposerAttachmentsFilenames"
diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js
index 9ce2f9ad4f0..e92799b7092 100644
--- a/addons/mail/static/src/models/composer/composer.js
+++ b/addons/mail/static/src/models/composer/composer.js
@@ -221,9 +221,6 @@ function factory(dependencies) {
message_type: 'comment',
partner_ids: this.recipients.map(partner => partner.id),
};
- if (this.subjectContent) {
- postData.subject = this.subjectContent;
- }
try {
let messageId;
this.update({ isPostingMessage: true });
@@ -760,7 +757,6 @@ function factory(dependencies) {
isLastStateChangeProgrammatic: true,
mentionedChannels: unlinkAll(),
mentionedPartners: unlinkAll(),
- subjectContent: "",
textInputContent: '',
textInputCursorEnd: 0,
textInputCursorStart: 0,
@@ -990,12 +986,6 @@ function factory(dependencies) {
threadSuggestedRecipientInfoListIsSelected: attr({
related: 'threadSuggestedRecipientInfoList.isSelected',
}),
- /**
- * Composer subject input content.
- */
- subjectContent: attr({
- default: "",
- }),
/**
* States which type of suggestion is currently in progress, if any.
* The value of this field contains the magic char that corresponds to
diff --git a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js
index 126d227d1f7..d9764b3a5ff 100644
--- a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js
+++ b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js
@@ -205,23 +205,6 @@ function factory(dependencies) {
return;
}
- // Message from mailing channel should not make a notification in
- // Odoo for users with notification "Handled by Email".
- // Channel has been marked as read server-side in this case, so
- // it should not display a notification by incrementing the
- // unread counter.
- if (
- channel.mass_mailing &&
- this.env.session.notification_type === 'email'
- ) {
- this._handleNotificationChannelSeen(channelId, {
- last_message_id: messageData.id,
- partner_id: this.env.messaging.currentPartner.id,
- });
- return;
- }
- // In all other cases: update counter and notify if necessary
-
// Chat from OdooBot is considered disturbing and should only be
// shown on the menu, but no notification and no thread open.
const isChatWithOdooBot = (
diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js
index 3602efec895..a2ae757b611 100644
--- a/addons/mail/static/src/models/thread/thread.js
+++ b/addons/mail/static/src/models/thread/thread.js
@@ -1168,9 +1168,6 @@ function factory(dependencies) {
if (this.model !== 'mail.channel') {
return false;
}
- if (this.mass_mailing) {
- return false;
- }
return ['chat', 'livechat'].includes(this.channel_type);
}
@@ -1797,7 +1794,6 @@ function factory(dependencies) {
default: false,
dependencies: [
'channel_type',
- 'mass_mailing',
'model',
],
}),
@@ -1932,9 +1928,6 @@ function factory(dependencies) {
mainCache: one2one('mail.thread_cache', {
compute: '_computeMainCache',
}),
- mass_mailing: attr({
- default: false,
- }),
members: many2many('mail.partner', {
inverse: 'memberThreads',
}),
diff --git a/addons/mail/static/src/models/thread_view/thread_view.js b/addons/mail/static/src/models/thread_view/thread_view.js
index bbc730fa3da..64a26e27345 100644
--- a/addons/mail/static/src/models/thread_view/thread_view.js
+++ b/addons/mail/static/src/models/thread_view/thread_view.js
@@ -82,12 +82,11 @@ function factory(dependencies) {
if (!this.thread) {
return;
}
- const isMailingList = this.thread.model === 'mail.channel' && this.thread.mass_mailing;
// Actually in mobile there is a send button, so we need there 'enter' to allow new line.
// Hence, we want to use a different shortcut 'ctrl/meta enter' to send for small screen
// size with a non-mailing channel.
// here send will be done on clicking the button or using the 'ctrl/meta enter' shortcut.
- if (this.env.messaging.device.isMobile || isMailingList) {
+ if (this.env.messaging.device.isMobile) {
return ['ctrl-enter', 'meta-enter'];
}
return ['enter'];
@@ -340,7 +339,6 @@ function factory(dependencies) {
'device',
'deviceIsMobile',
'thread',
- 'threadMassMailing',
'threadModel',
],
}),
@@ -394,12 +392,6 @@ function factory(dependencies) {
default: {},
related: 'threadViewer.threadCacheInitialScrollPositions',
}),
- /**
- * Serves as compute dependency.
- */
- threadMassMailing: attr({
- related: 'thread.mass_mailing',
- }),
/**
* Serves as compute dependency.
*/
diff --git a/addons/mail/static/tests/helpers/mock_models.js b/addons/mail/static/tests/helpers/mock_models.js
index 35b90aad3d4..0cd8e7df6ab 100644
--- a/addons/mail/static/tests/helpers/mock_models.js
+++ b/addons/mail/static/tests/helpers/mock_models.js
@@ -78,8 +78,6 @@ export class MockModels {
is_minimized: { string: "isMinimized", type: "boolean", default: false },
// In python this belongs to mail.channel.partner. Here for simplicity.
is_pinned: { string: "isPinned", type: "boolean", default: true },
- // In python: email_send.
- mass_mailing: { string: "Send messages by email", type: "boolean", default: false },
members: { string: "Members", type: 'many2many', relation: 'res.partner', default() { return [this.currentPartnerId]; } },
message_unread_counter: { string: "# unread messages", type: 'integer' },
name: { string: "Name", type: "char", required: true },
diff --git a/addons/mail/static/tests/helpers/mock_server.js b/addons/mail/static/tests/helpers/mock_server.js
index a0e829b3e1c..653da4326ac 100644
--- a/addons/mail/static/tests/helpers/mock_server.js
+++ b/addons/mail/static/tests/helpers/mock_server.js
@@ -686,7 +686,6 @@ MockServer.include({
// an existing chat.
const id = this._mockCreate('mail.channel', {
channel_type: 'chat',
- mass_mailing: false,
is_minimized: true,
is_pinned: true,
members: [[6, 0, partners_to]],
diff --git a/addons/mail/tests/test_mail_channel.py b/addons/mail/tests/test_mail_channel.py
index cfe5c7fdb33..c2846f55f99 100644
--- a/addons/mail/tests/test_mail_channel.py
+++ b/addons/mail/tests/test_mail_channel.py
@@ -150,7 +150,6 @@ class TestChannelInternals(MailCommon):
cls.test_channel = cls.env['mail.channel'].with_context(cls._test_context).create({
'name': 'Test',
'channel_type': 'channel',
- 'email_send': False,
'description': 'Description',
'alias_name': 'test',
'public': 'public',
@@ -216,7 +215,6 @@ class TestChannelInternals(MailCommon):
""" Posting a message on a chat should not send emails """
self.test_channel.write({
'channel_type': 'chat',
- 'email_send': False
})
self.test_channel._action_add_members(self.partner_employee | self.partner_admin | self.test_partner)
with self.mock_mail_gateway():
@@ -229,29 +227,6 @@ class TestChannelInternals(MailCommon):
self.assertEqual(new_msg.partner_ids, self.env['res.partner'])
self.assertEqual(new_msg.notified_partner_ids, self.env['res.partner'])
- @mute_logger('odoo.addons.mail.models.mail_mail', 'odoo.models.unlink')
- def test_channel_recipients_mailing_list(self):
- """ Posting a message on a mailing list should send one email to all recipients """
- self.test_channel.write({'email_send': True})
- (self.user_admin | self.user_employee).write({'notification_type': 'email'})
-
- # Subscribe an user without email. We shouldn't try to send email to them.
- self.test_channel._action_add_members(self.partner_employee | self.partner_admin | self.test_partner | self.partner_employee_nomail)
- with self.mock_mail_gateway():
- with self.with_user('employee'):
- channel = self.env['mail.channel'].browse(self.test_channel.ids)
- channel.message_post(body="Test", message_type='comment', subtype_xmlid='mail.mt_comment')
- self.assertSentEmail(self.partner_employee, [self.partner_admin, self.test_partner])
-
- # test mailing with with inbox notification type
- self.user_admin.write({'notification_type': 'inbox'})
- self.user_admin.flush()
- with self.mock_mail_gateway():
- with self.with_user('employee'):
- channel = self.env['mail.channel'].browse(self.test_channel.ids)
- channel.message_post(body="Test", message_type='comment', subtype_xmlid='mail.mt_comment')
- self.assertSentEmail(self.partner_employee, [self.test_partner])
-
@mute_logger('odoo.addons.mail.models.mail_mail', 'odoo.models.unlink')
def test_channel_recipients_mention(self):
""" Posting a message on a classic channel should support mentioning somebody """
@@ -395,7 +370,6 @@ class TestChannelInternals(MailCommon):
even if `_action_unfollow()` is called again.
'''
channel = self.env['mail.channel'].browse(self.test_channel.id)
- channel.write({'email_send': False})
channel._action_add_members(self.test_partner)
# no message should be posted under test_partner's name
@@ -434,71 +408,3 @@ class TestChannelInternals(MailCommon):
allowed_company_ids=self.company_admin.ids
).channel_get(self.partner_employee_c2.ids)
self.assertTrue(initial_channel_info, 'should be able to chat with multi company user')
-
- def test_multi_company_message_post_notifications(self):
- company_1 = self.company_admin
- company_2 = self.env['res.company'].create({'name': 'Company 2'})
-
- # Company 1 and notification_type == "inbox"
- user_1 = self.user_employee
-
- # Company 1 and notification_type == "email"
- user_2 = self.user_admin
- user_2.notification_type = 'email'
-
- user_3 = mail_new_test_user(
- self.env, login='user3', email='user3@example.com', groups='base.group_user',
- company_id=company_2.id, company_ids=[(6, 0, company_2.ids)],
- name='user3', notification_type='inbox')
-
- user_4 = mail_new_test_user(
- self.env, login='user4', email='user4@example.com', groups='base.group_user',
- company_id=company_2.id, company_ids=[(6, 0, company_2.ids)],
- name='user4', notification_type='email')
-
- partner_without_user = self.env['res.partner'].create({
- 'name': 'Partner',
- 'email': 'partner_test_123@example.com',
- })
- mail_channel = self.env['mail.channel'].with_user(user_1).create({
- 'name': 'Channel',
- 'channel_partner_ids': [
- (4, user_1.partner_id.id),
- (4, user_2.partner_id.id),
- (4, user_3.partner_id.id),
- (4, user_4.partner_id.id),
- (4, partner_without_user.id),
- ],
- 'email_send': True,
- })
-
- mail_channel.invalidate_cache()
- (user_1 | user_2 | user_3 | user_4).invalidate_cache()
-
- with self.mock_mail_gateway():
- mail_channel.with_user(user_1).with_company(company_1).message_post(
- body='Test body message 1337',
- message_type='email',
- subtype_xmlid='mail.mt_comment',
- )
-
- self.assertSentEmail(user_1.partner_id, [user_2.partner_id])
- self.assertSentEmail(user_1.partner_id, [user_4.partner_id])
- self.assertEqual(len(self._mails), 3, 'Should have send only 3 emails to user 2, user 4 and the partner')
-
- self.assertBusNotifications([(self.cr.dbname, 'mail.channel', mail_channel.id)])
-
- # Should not create mail notifications for user 1 & 3
- self.assertFalse(self.env['mail.notification'].search([('res_partner_id', '=', user_1.partner_id.id)]))
- self.assertFalse(self.env['mail.notification'].search([('res_partner_id', '=', user_3.partner_id.id)]))
-
- # Should create mail notifications for user 2 & 4
- self.assertTrue(self.env['mail.notification'].search([('res_partner_id', '=', user_2.partner_id.id)]))
- self.assertTrue(self.env['mail.notification'].search([('res_partner_id', '=', user_4.partner_id.id)]))
-
- # Check that we did not send a "channel_seen" notifications
- # for the users which receive the notifications by email
- notification_seen_user_2 = self.env['bus.bus'].search([('create_uid', '=', user_2.id)])
- self.assertFalse(notification_seen_user_2, 'Should not have sent a notification as user 2')
- notification_seen_user_4 = self.env['bus.bus'].search([('create_uid', '=', user_4.id)])
- self.assertFalse(notification_seen_user_4, 'Should not have sent a notification as user 4')
diff --git a/addons/mail/views/mail_channel_views.xml b/addons/mail/views/mail_channel_views.xml
index 4ead4fd6336..e24cc7b697c 100644
--- a/addons/mail/views/mail_channel_views.xml
+++ b/addons/mail/views/mail_channel_views.xml
@@ -54,7 +54,6 @@
-
diff --git a/addons/mass_mailing/tests/test_mailing_internals.py b/addons/mass_mailing/tests/test_mailing_internals.py
index 696e187d90e..6b39104e9dc 100644
--- a/addons/mass_mailing/tests/test_mailing_internals.py
+++ b/addons/mass_mailing/tests/test_mailing_internals.py
@@ -140,44 +140,6 @@ class TestMassMailFeatures(MassMailCommon, CronMixinCase):
super(TestMassMailFeatures, cls).setUpClass()
cls._create_mailing_list()
- @users('user_marketing')
- @mute_logger('odoo.addons.mail.models.mail_mail')
- def test_channel_blacklisted_recipients(self):
- """ Posting a message on a channel should send one email to all recipients, except the blacklisted ones """
- test_channel = self.env['mail.channel'].create({
- 'name': 'Test',
- 'description': 'Description',
- 'alias_name': 'test',
- 'public': 'public',
- 'email_send': True,
- })
- test_partner = self.env['res.partner'].create({
- 'name': 'Test Partner',
- 'email': 'test@example.com',
- })
-
- blacklisted_partner = self.env['res.partner'].create({
- 'name': 'Blacklisted Partner',
- 'email': 'test@black.list',
- })
-
- # Set Blacklist
- self.env['mail.blacklist'].create({
- 'email': 'test@black.list',
- })
-
- test_channel._action_add_members(test_partner + blacklisted_partner)
- with self.mock_mail_gateway():
- test_channel.message_post(body="Test", message_type='comment', subtype_xmlid='mail.mt_comment')
-
- self.assertEqual(len(self._mails), 1, 'Number of mail incorrect. Should be equal to 1.')
- for email in self._mails:
- self.assertEqual(
- set(email['email_to']),
- set([formataddr((test_partner.name, test_partner.email))]),
- 'email_to incorrect. Should be equal to "%s"' % (
- formataddr((test_partner.name, test_partner.email))))
-
@users('user_marketing')
@mute_logger('odoo.addons.mail.models.mail_mail')
def test_mailing_cron_trigger(self):
diff --git a/addons/website_livechat/models/website_visitor.py b/addons/website_livechat/models/website_visitor.py
index b598b724c19..c42c7547dec 100644
--- a/addons/website_livechat/models/website_visitor.py
+++ b/addons/website_livechat/models/website_visitor.py
@@ -69,7 +69,6 @@ class WebsiteVisitor(models.Model):
'livechat_operator_id': self.env.user.partner_id.id,
'channel_type': 'livechat',
'public': 'private',
- 'email_send': False,
'country_id': country.id,
'anonymous_name': visitor_name,
'name': ', '.join([visitor_name, operator.livechat_username if operator.livechat_username else operator.name]),