Merge branch 'master' into circular

* master:
  Fixing huge bug in mark_feed_read for socialsubs.
  Increasing logging on read social sub stories.
  Shift+a to mark as read for blurblogs.
  Shift+a to mark as read for blurblogs.
  Marking as read covers both socialsubs and feeds.

Conflicts:
	apps/reader/views.py
This commit is contained in:
Samuel Clay 2013-04-22 13:53:56 -07:00
commit 2412dc8b4e
3 changed files with 12 additions and 10 deletions

View file

@ -870,6 +870,7 @@ def load_river_stories__redis(request):
def mark_all_as_read(request):
code = 1
days = int(request.POST.get('days', 0))
read_date = datetime.datetime.utcnow() - datetime.timedelta(days=days)
feeds = UserSubscription.objects.filter(user=request.user)
socialsubs = MSocialSubscription.objects.filter(user_id=request.user.pk)
@ -878,7 +879,6 @@ def mark_all_as_read(request):
if days == 0:
sub.mark_feed_read()
else:
read_date = datetime.datetime.utcnow() - datetime.timedelta(days=days)
if sub.mark_read_date < read_date:
sub.needs_unread_recalc = True
sub.mark_read_date = read_date

View file

@ -952,11 +952,13 @@ class MSocialSubscription(mongo.Document):
story = MSharedStory.objects.get(user_id=self.subscription_user_id,
story_guid=story_id)
except MSharedStory.DoesNotExist:
if settings.DEBUG:
logging.user(request, "~BR~FYCould not find story: %s/%s" %
(self.subscription_user_id, story_id))
continue
now = datetime.datetime.utcnow()
date = now if now > story.story_date else story.story_date # For handling future stories
if not feed_id:
feed_id = story.story_feed_id
feed_id = story.story_feed_id
try:
m, _ = MUserStory.objects.get_or_create(user_id=self.user_id,
feed_id=feed_id,
@ -966,11 +968,11 @@ class MSocialSubscription(mongo.Document):
"story_date": story.shared_date,
})
except NotUniqueError:
if not mark_all_read:
if not mark_all_read or settings.DEBUG:
logging.user(request, "~FRAlready saved read story: %s" % story.story_guid)
continue
except MUserStory.MultipleObjectsReturned:
if not mark_all_read:
if not mark_all_read or settings.DEBUG:
logging.user(request, "~BR~FW~SKMultiple read stories: %s" % story.story_guid)
# Find other social feeds with this story to update their counts
@ -1052,7 +1054,7 @@ class MSocialSubscription(mongo.Document):
latest_story_date = latest_shared_story['shared_date'] + datetime.timedelta(seconds=1)
self.last_read_date = latest_story_date
self.mark_read_date = UNREAD_CUTOFF
self.mark_read_date = latest_story_date
self.unread_count_negative = 0
self.unread_count_positive = 0
self.unread_count_neutral = 0

View file

@ -4046,11 +4046,11 @@
this.toggle_focus_in_slider();
},
feed_unread_count: function(feed_id) {
feed_unread_count: function(feed_id, callback) {
feed_id = feed_id || this.active_feed;
if (!feed_id) return;
this.model.feed_unread_count(feed_id);
this.model.feed_unread_count(feed_id, callback);
},
update_interactions_count: function() {
@ -5530,9 +5530,9 @@
});
$document.bind('keydown', 'shift+a', function(e) {
e.preventDefault();
if (self.flags.social_view && self.flags.river_view) {
if (_.contains(['river:blurblogs', 'river:global'], self.active_feed)) {
return;
} else if (self.flags.social_view && !self.flags.river_view) {
} else if (self.flags.social_view) {
self.mark_feed_as_read();
} else if (self.flags.river_view) {
if (self.active_feed == 'river:') {