Fixing bug around refresh social feeds that have no unread stories, so they have no last unread dates.

This commit is contained in:
Samuel Clay 2012-04-03 20:28:18 -07:00
parent 60ab83a715
commit d9d80939b0

View file

@ -446,8 +446,10 @@ class MSocialSubscription(mongo.Document):
for i, sub in enumerate(user_subs):
# Count unreads if subscription is stale.
if (sub.needs_unread_recalc or
sub.unread_count_updated < UNREAD_CUTOFF or
sub.oldest_unread_story_date < UNREAD_CUTOFF):
(sub.unread_count_updated and
sub.unread_count_updated < UNREAD_CUTOFF) or
(sub.oldest_unread_story_date and
sub.oldest_unread_story_date < UNREAD_CUTOFF)):
sub = sub.calculate_feed_scores(silent=True)
feed_id = "social:%s" % sub.subscription_user_id