Updating starred tag counts on adding/removing tags.

This commit is contained in:
Samuel Clay 2013-08-16 18:26:56 -07:00
parent 582364c64d
commit 0a827a91fe
4 changed files with 7 additions and 2 deletions

View file

@ -1754,10 +1754,10 @@ def mark_story_as_unstarred(request):
if not starred_story:
starred_story = MStarredStory.objects(user_id=request.user.pk, story_hash=story_id)
if starred_story:
logging.user(request, "~FCUnstarring: ~SB%s" % (starred_story[0].story_title[:50]))
starred_story.delete()
MStarredStoryCounts.count_tags_for_user(request.user.pk)
starred_counts = MStarredStoryCounts.user_counts(request.user.pk)
logging.user(request, "~FCUnstarring: ~SB%s" % (starred_story[0].story_title[:50]))
else:
code = -1

View file

@ -262,6 +262,11 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
if (callback) callback(data);
};
var pre_callback = function(data) {
self.starred_feeds.reset(data.starred_counts, {parse: true, update: true});
if (callback) callback(data);
};
this.make_request('/reader/mark_story_as_unstarred', {
story_id: story_id
}, pre_callback);

View file

@ -9,6 +9,7 @@ NEWSBLUR.Router = Backbone.Router.extend({
"saved": "starred",
"saved/:tag": "starred",
"folder/saved": "starred",
"folder/saved/:tag": "starred",
"folder/:folder_name": "folder",
"folder/:folder_name/": "folder",
"social/:user_id/:slug": "social",

View file

@ -23,7 +23,6 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
this.$s.$feed_link_loader.css({'display': 'block'});
NEWSBLUR.assets.feeds.bind('reset', _.bind(function() {
this.make_feeds();
this.make_starred_tags();
// TODO: Refactor this to load after both feeds and social feeds load.
this.load_router();