mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 23:19:10 +00:00
Add context to at mention missed messages
When you are at mentioned in a stream we will now send you up to the last five messages which were sent in the past 5 minutes on the same topic and stream. (imported from commit 6df6c1cf868722a7bf76e54710e38741a7ac8f31)
This commit is contained in:
committed by
Steve Howell
parent
6c424e8446
commit
710a802f49
@@ -23,6 +23,7 @@ import zlib
|
||||
|
||||
from bitfield import BitField
|
||||
from collections import defaultdict
|
||||
from datetime import timedelta
|
||||
import pylibmc
|
||||
import re
|
||||
import ujson
|
||||
@@ -968,6 +969,15 @@ def pre_save_message(sender, **kwargs):
|
||||
message = kwargs['instance']
|
||||
message.update_calculated_fields()
|
||||
|
||||
def get_context_for_message(message):
|
||||
return Message.objects.filter(
|
||||
recipient_id=message.recipient_id,
|
||||
subject=message.subject,
|
||||
id__lt=message.id,
|
||||
pub_date__gt=message.pub_date - timedelta(minutes=5),
|
||||
).order_by('-id')[:5]
|
||||
|
||||
|
||||
class UserMessage(models.Model):
|
||||
user_profile = models.ForeignKey(UserProfile)
|
||||
message = models.ForeignKey(Message)
|
||||
|
||||
Reference in New Issue
Block a user