[MERGE] forward port branch 9.0 up to 74b564cf8d
This commit is contained in:
@@ -149,7 +149,7 @@ class Message(models.Model):
|
||||
given, restrict to messages written in one of those channels. """
|
||||
partner_id = self.env.user.partner_id.id
|
||||
delete_mode = not self.env.user.share # delete employee notifs, keep customer ones
|
||||
if domain is None and delete_mode:
|
||||
if not domain and delete_mode:
|
||||
query = "DELETE FROM mail_message_res_partner_needaction_rel WHERE res_partner_id IN %s"
|
||||
args = [(partner_id,)]
|
||||
if channel_ids:
|
||||
|
||||
@@ -35,6 +35,32 @@ class TestMailFeatures(TestMail):
|
||||
self.assertEqual(na_emp1_new, na_emp1_base + 1)
|
||||
self.assertEqual(na_emp2_new, na_emp2_base)
|
||||
|
||||
@mute_logger('openerp.addons.mail.models.mail_mail')
|
||||
def test_mark_all_as_read(self):
|
||||
portal_partner = self.user_portal.partner_id.sudo(self.user_portal.id)
|
||||
|
||||
# mark all as read clear needactions
|
||||
self.group_pigs.message_post(body='Test', message_type='comment', subtype='mail.mt_comment', partner_ids=[portal_partner.id])
|
||||
portal_partner.env['mail.message'].mark_all_as_read(channel_ids=[], domain=[])
|
||||
na_count = portal_partner.get_needaction_count()
|
||||
self.assertEqual(na_count, 0, "mark all as read should conclude all needactions")
|
||||
|
||||
# mark all as read also clear inaccessible needactions
|
||||
new_msg = self.group_pigs.message_post(body='Zest', message_type='comment', subtype='mail.mt_comment', partner_ids=[portal_partner.id])
|
||||
needaction_accessible = len(portal_partner.env['mail.message'].search([['needaction', '=', True]]))
|
||||
self.assertEqual(needaction_accessible, 1, "a new message to a partner is readable to that partner")
|
||||
|
||||
new_msg.sudo().partner_ids = self.env['res.partner']
|
||||
needaction_length = len(portal_partner.env['mail.message'].search([['needaction', '=', True]]))
|
||||
self.assertEqual(needaction_length, 0, "removing access of a message make it not readable")
|
||||
|
||||
na_count = portal_partner.get_needaction_count()
|
||||
self.assertEqual(na_count, 1, "message not accessible is currently still counted")
|
||||
|
||||
portal_partner.env['mail.message'].mark_all_as_read(channel_ids=[], domain=[])
|
||||
na_count = portal_partner.get_needaction_count()
|
||||
self.assertEqual(na_count, 0, "mark all read should conclude all needactions even inacessible ones")
|
||||
|
||||
|
||||
class TestMessagePost(TestMail):
|
||||
|
||||
|
||||
@@ -213,6 +213,15 @@ class MaintenanceEquipment(models.Model):
|
||||
self.message_subscribe_users(user_ids=[vals['owner_user_id']])
|
||||
return super(MaintenanceEquipment, self).write(vals)
|
||||
|
||||
@api.model
|
||||
def _message_get_auto_subscribe_fields(self, updated_fields, auto_follow_fields=None):
|
||||
""" mail.thread override so user_id which has no special access allowance is not
|
||||
automatically subscribed.
|
||||
"""
|
||||
if auto_follow_fields is None:
|
||||
auto_follow_fields = []
|
||||
return super(MaintenanceEquipment, self)._message_get_auto_subscribe_fields(updated_fields, auto_follow_fields)
|
||||
|
||||
@api.model
|
||||
def _read_group_category_ids(self, categories, domain, order):
|
||||
""" Read group customization in order to display all the categories in
|
||||
|
||||
@@ -112,11 +112,6 @@
|
||||
<i class="fa fa-cloud-upload"></i> Upload
|
||||
</a>
|
||||
</t>
|
||||
<t t-if="channel.can_upload and is_public_user">
|
||||
<a class="btn btn-primary" title="Upload Presentation" t-attf-href="/web/login?redirect=/slides/#{slug(channel)}">
|
||||
<i class="fa fa-cloud-upload"></i> Upload
|
||||
</a>
|
||||
</t>
|
||||
</h3>
|
||||
</div>
|
||||
<!-- Search box -->
|
||||
|
||||
Reference in New Issue
Block a user