Fixing mistakenly unread stories while searching.

This commit is contained in:
Samuel Clay 2013-07-29 15:11:20 -07:00
parent d49e9569a5
commit fdd4cdea25
2 changed files with 8 additions and 8 deletions

View file

@ -579,7 +579,7 @@ def load_single_feed(request, feed_id):
unread_story_hashes = []
if stories:
if read_filter == 'all' and usersub:
if (read_filter == 'all' or query) and usersub:
unread_story_hashes = usersub.get_stories(read_filter='unread', limit=500, hashes_only=True)
story_hashes = [story['story_hash'] for story in stories]
starred_stories = MStarredStory.objects(user_id=user.pk,
@ -604,10 +604,10 @@ def load_single_feed(request, feed_id):
story['long_parsed_date'] = format_story_link_date__long(story_date, now)
if usersub:
story['read_status'] = 1
if read_filter == 'unread' and usersub:
story['read_status'] = 0
elif read_filter == 'all' and usersub:
if (read_filter == 'all' or query) and usersub:
story['read_status'] = 1 if story['story_hash'] not in unread_story_hashes else 0
elif read_filter == 'unread' and usersub:
story['read_status'] = 0
if story['story_hash'] in starred_stories:
story['starred'] = True
starred_date = localtime_for_timezone(starred_stories[story['story_hash']],

View file

@ -105,7 +105,7 @@ def load_social_stories(request, user_id, username=None):
classifier_tags = classifier_tags + list(MClassifierTag.objects(user_id=user.pk, feed_id__in=story_feed_ids))
unread_story_hashes = []
if read_filter == 'all' and socialsub:
if (read_filter == 'all' or query) and socialsub:
unread_story_hashes = socialsub.get_stories(read_filter='unread', limit=500)
story_hashes = [story['story_hash'] for story in stories]
@ -128,10 +128,10 @@ def load_social_stories(request, user_id, username=None):
story['long_parsed_date'] = format_story_link_date__long(shared_date, now)
story['read_status'] = 1
if read_filter == 'unread' and socialsub:
story['read_status'] = 0
elif read_filter == 'all' and socialsub:
if (read_filter == 'all' or query) and socialsub:
story['read_status'] = 1 if story['story_hash'] not in unread_story_hashes else 0
elif read_filter == 'unread' and socialsub:
story['read_status'] = 0
if story['story_hash'] in starred_stories:
story['starred'] = True