Exclude dormant users from the buddy list.

You must have accessed Zulip in the last 45 days to show up
on the list.

(imported from commit ebfaeb97ffda22b618be7a9206877f9d2ec53404)
This commit is contained in:
Steve Howell 2014-07-15 20:16:28 -07:00 committed by Waseem Daher
parent 50c43b45ee
commit 187469ea86

View File

@ -28,6 +28,7 @@ import pylibmc
import re
import ujson
import logging
import datetime
bugdown = None
@ -1152,7 +1153,9 @@ class UserPresence(models.Model):
def get_status_dict_by_realm(realm_id):
user_statuses = defaultdict(dict)
dormancy_cutoff_date = datetime.datetime.now() - datetime.timedelta(days=45)
query = UserPresence.objects.filter(
timestamp__gte=dormancy_cutoff_date,
user_profile__realm_id=realm_id,
user_profile__is_active=True,
user_profile__is_bot=False