Merge branch 'muserstory_remove' into circular

* muserstory_remove:
  Fixing remaining share hash bug. Shared stories wouldnt show as shared on original feed.
This commit is contained in:
Samuel Clay 2013-05-15 12:36:30 -07:00
commit b322adb509
2 changed files with 3 additions and 7 deletions

View file

@ -3,7 +3,6 @@ import time
import boto
import redis
import requests
import random
from django.shortcuts import get_object_or_404
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
@ -556,7 +555,7 @@ def load_single_feed(request, feed_id):
shared_stories = MSharedStory.objects(user_id=user.pk,
story_feed_id=feed_id,
story_hash__in=story_hashes)\
.only('story_guid', 'shared_date', 'comments')
.only('story_hash', 'shared_date', 'comments')
starred_stories = dict([(story.story_hash, story.starred_date) for story in starred_stories])
shared_stories = dict([(story.story_hash, dict(shared_date=story.shared_date, comments=story.comments))
for story in shared_stories])
@ -997,7 +996,7 @@ def mark_story_as_unread(request):
newer_stories = MStory.objects(story_feed_id=story.story_feed_id,
story_date__gte=story.story_date,
story_date__lte=usersub.mark_read_date
).only('story_guid')
).only('story_hash')
newer_stories = [s.story_hash for s in newer_stories]
usersub.mark_read_date = story.story_date - datetime.timedelta(minutes=1)
usersub.needs_unread_recalc = True

View file

@ -1078,10 +1078,8 @@ class MSocialSubscription(mongo.Document):
stories_db = MSharedStory.objects(user_id=self.subscription_user_id,
story_hash__in=unread_story_hashes)
story_feed_ids = set()
story_ids = []
for s in stories_db:
story_feed_ids.add(s['story_feed_id'])
story_ids.append(s['story_guid'])
story_feed_ids = list(story_feed_ids)
usersubs = UserSubscription.objects.filter(user__pk=self.user_id, feed__pk__in=story_feed_ids)
@ -1614,8 +1612,7 @@ class MSharedStory(mongo.Document):
shared_stories = []
if sharer_user_ids:
params = {
'story_guid': story['id'],
'story_feed_id': story['story_feed_id'],
'story_hash': story['story_hash'],
'user_id__in': sharer_user_ids,
}
shared_stories = cls.objects.filter(**params)