[IMP] mail.thread: added the hiding method. However, this won t work with automatic subscriptions. Will need to be managed. Updating mail.js to be able to hide subtypes.
bzr revid: tde@openerp.com-20120420120948-er9xsc575fjf04mc
This commit is contained in:
parent
f540a782b4
commit
c4e6874e23
|
@ -783,6 +783,22 @@ class mail_thread(osv.osv):
|
|||
subscription_obj.unlink(cr, uid, to_delete_sub_ids, context=context)
|
||||
return True
|
||||
|
||||
def message_subscription_hide(self, cr, uid, ids, subtype=None, context=None):
|
||||
"""Hide notifications, allowing to tune the messages displayed on
|
||||
the Wall.
|
||||
:param subtype: a mail.message subtype. If None, it is means the
|
||||
user wants to hide all notifications coming from
|
||||
the document.
|
||||
"""
|
||||
subscription_obj = self.pool.get('mail.subscription')
|
||||
subscription_hide_obj = self.pool.get('mail.subscription.hide')
|
||||
# find the related subscriptions
|
||||
subscription_ids = subscription_obj.search(cr, uid, [('res_model', '=', self._name), ('res_id', 'in', ids), ('user_id', '=', uid)], context=context)
|
||||
# hide it
|
||||
for subscription_id in subscription_ids:
|
||||
subscription_hide_obj.create(cr, uid, {'subscription_id': subscription_id, 'subtype': subtype}, context=context)
|
||||
return True
|
||||
|
||||
#------------------------------------------------------
|
||||
# Notification API
|
||||
#------------------------------------------------------
|
||||
|
|
|
@ -190,12 +190,12 @@ openerp.mail = function(session) {
|
|||
});
|
||||
// event: click on 'hide this type' in wheel_menu
|
||||
this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_hide_type', 'click', function (event) {
|
||||
console.log('hiding type');
|
||||
//console.log('hiding type');
|
||||
if (! confirm(_t("Do you really want to hide this thread ?"))) { return false; }
|
||||
var msg_id = event.srcElement.dataset.id;
|
||||
if (! msg_id) return false;
|
||||
console.log(msg_id);
|
||||
//var call_defer = self.ds.call('message_remove_pushed_notifications', [[self.params.res_id], [parseInt(msg_id)], true]);
|
||||
var subtype = event.srcElement.dataset.subtype;
|
||||
if (! subtype) return false;
|
||||
//console.log(subtype);
|
||||
var call_defer = self.ds.call('message_subscription_hide', [[self.params.res_id], subtype]);
|
||||
$(event.srcElement).parents('li.oe_mail_thread_msg').eq(0).hide();
|
||||
if (self.params.thread_level > 0) {
|
||||
$(event.srcElement).parents('ul.oe_mail_thread').eq(0).hide();
|
||||
|
|
|
@ -60,8 +60,8 @@
|
|||
<div t-attf-class="oe_mail_msg_#{record.type}">
|
||||
<img class="oe_mail_msg_menu_icon" src="/mail/static/src/img/wheel_menu.png" alt="menu"/>
|
||||
<ul class="oe_mail_msg_menu">
|
||||
<li><a href="#" class="oe_mail_msg_hide_thread">Hide this thread</a></li>
|
||||
<li><a href="#" class="oe_mail_msg_hide_type">Hide this type: <t t-esc="record.subtype"/>
|
||||
<li><a href="#" class="oe_mail_msg_hide_thread" t-attf-data-id='{record.id}'>Hide this thread</a></li>
|
||||
<li><a href="#" class="oe_mail_msg_hide_type" t-attf-data-subtype='{record.subtype}'>Hide this type: <t t-esc="record.subtype"/>
|
||||
</a></li>
|
||||
</ul>
|
||||
<img class="oe_mail_msg_image oe_mail_oe_left" t-att-src="record.mini_url"/>
|
||||
|
|
Loading…
Reference in New Issue