changeset 693:1d60fa4d25a4

browser_side: fixes new message alerts
author souliane <souliane@mailoo.org>
date Thu, 16 Apr 2015 13:29:26 +0200
parents 7a9c7b9f6a28
children 82123705474b
files src/browser/sat_browser/contact_list.py src/browser/sat_browser/contact_widget.py
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_list.py	Thu Apr 09 11:37:25 2015 +0200
+++ b/src/browser/sat_browser/contact_list.py	Thu Apr 16 13:29:26 2015 +0200
@@ -128,6 +128,7 @@
 
         def on_click(contact_jid):
             self.host.displayWidget(chat.Chat, contact_jid, type_=C.CHAT_ONE2ONE)
+            self.removeAlert(contact_jid, True)
 
         self._contacts_panel = contact_panel.ContactsPanel(host, contacts_click=on_click, contacts_menus=(C.MENU_JID_CONTEXT, C.MENU_ROSTER_JID_CONTEXT))
         self._contacts_panel.setStyleName('contactPanel') # FIXME: style doesn't exists !
--- a/src/browser/sat_browser/contact_widget.py	Thu Apr 09 11:37:25 2015 +0200
+++ b/src/browser/sat_browser/contact_widget.py	Thu Apr 16 13:29:26 2015 +0200
@@ -31,6 +31,7 @@
 import html_tools
 import base_widget
 import libervia_widget
+import contact_list
 
 unicode = str # XXX: pyjama doesn't manage unicode
 
@@ -56,7 +57,8 @@
 
     def update(self):
         clist = self.host.contact_list
-        alert_html = "<strong>(*)</strong>&nbsp;" if self.jid in clist._alerts else ""
+        alerts = clist._alerts if self.jid.resource else contact_list.JIDList([contact.bare for contact in clist._alerts])
+        alert_html = "<strong>(*)</strong>&nbsp;" if self.jid in alerts else ""
 
         contact_raw = None
         for disp in self.display: