From c4ac3000aac59c7e145ec0aef56a3bc1218cddb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Evren=20Esat=20=C3=96zkan?= Date: Thu, 28 Jul 2016 12:35:32 +0300 Subject: [PATCH] ~ --- zengine/messaging/model.py | 5 +++-- zengine/messaging/views.py | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/zengine/messaging/model.py b/zengine/messaging/model.py index 73108fe0..765d9e9b 100644 --- a/zengine/messaging/model.py +++ b/zengine/messaging/model.py @@ -225,14 +225,14 @@ def is_online(self): def unread_count(self): if self.last_seen_msg_time: return self.channel.message_set.objects.filter( - timestamp__gt=self.last_seen_msg_time).count() + updated_at__gt=self.last_seen_msg_time).count() else: return self.channel.message_set.objects.filter().count() def get_unread_messages(self, amount): if self.last_seen_msg_time: return self.channel.message_set.objects.filter( - timestamp__gt=self.last_seen_msg_time)[:amount] + updated_at__gt=self.last_seen_msg_time)[:amount] else: return self.channel.message_set.objects.filter()[:amount] @@ -357,6 +357,7 @@ def serialize(self, user=None): 'is_update': hasattr(self, 'unsaved'), 'attachments': [attachment.serialize() for attachment in self.attachment_set], 'title': self.msg_title, + 'url': self.url, 'sender_name': self.sender.full_name, 'sender_key': self.sender.key, 'channel_key': self.channel.key, diff --git a/zengine/messaging/views.py b/zengine/messaging/views.py index b8ffc255..927f01af 100644 --- a/zengine/messaging/views.py +++ b/zengine/messaging/views.py @@ -33,6 +33,7 @@ 'sender_name': string, 'sender_key': key, 'type': int, + 'url': string, 'avatar_url': string, 'key': key, 'cmd': 'message', @@ -323,6 +324,8 @@ def unread_count(current): else: unread_msg += sbs.unread_count() except ObjectDoesNotExist: + # FIXME: This should not happen, + log.exception("MULTIPLE PRV EXCHANGES!!!!") sbs.delete() current.output = { 'status': 'OK',