Fixing header counts issue when always showing folder counts and having blurblogs unintentionally collapsed.

This commit is contained in:
Samuel Clay 2012-10-24 19:28:54 -07:00
parent 3e1b00f941
commit ffed6046b2
3 changed files with 17 additions and 6 deletions

View file

@ -103,7 +103,7 @@ class MSocialProfile(mongo.Document):
super(MSocialProfile, self).save(*args, **kwargs) super(MSocialProfile, self).save(*args, **kwargs)
if self.user_id not in self.following_user_ids: if self.user_id not in self.following_user_ids:
self.follow_user(self.user_id) self.follow_user(self.user_id, force=True)
self.count_follows() self.count_follows()
@property @property
@ -351,7 +351,7 @@ class MSocialProfile(mongo.Document):
logging.debug(" ---> ~FB~SB%s~SN (%s) following %s" % (self.username, self.user_id, user_id)) logging.debug(" ---> ~FB~SB%s~SN (%s) following %s" % (self.username, self.user_id, user_id))
if not followee.protected: if not followee.protected or force:
if user_id not in self.following_user_ids: if user_id not in self.following_user_ids:
self.following_user_ids.append(user_id) self.following_user_ids.append(user_id)
elif not force: elif not force:
@ -2136,7 +2136,7 @@ class MInteraction(mongo.Document):
meta = { meta = {
'collection': 'interactions', 'collection': 'interactions',
'indexes': [('user_id', '-date'), 'category'], 'indexes': [('user_id', '-date'), 'category', 'with_user_id'],
'allow_inheritance': False, 'allow_inheritance': False,
'index_drop_dups': True, 'index_drop_dups': True,
'ordering': ['-date'], 'ordering': ['-date'],
@ -2335,7 +2335,7 @@ class MActivity(mongo.Document):
meta = { meta = {
'collection': 'activities', 'collection': 'activities',
'indexes': [('user_id', '-date'), 'category'], 'indexes': [('user_id', '-date'), 'category', 'with_user_id'],
'allow_inheritance': False, 'allow_inheritance': False,
'index_drop_dups': True, 'index_drop_dups': True,
'ordering': ['-date'], 'ordering': ['-date'],

View file

@ -102,7 +102,11 @@ NEWSBLUR.Views.SocialProfileBadge = Backbone.View.extend({
}, [ }, [
$.make('img', { src: NEWSBLUR.Globals.MEDIA_URL + 'img/icons/silk/lock.png' }), $.make('img', { src: NEWSBLUR.Globals.MEDIA_URL + 'img/icons/silk/lock.png' }),
$.make('span', 'Follow') $.make('span', 'Follow')
]) ]),
(!profile.get('private') && $.make('div', {
className: 'NB-profile-badge-action-preview NB-modal-submit-button NB-modal-submit-grey ' +
(!profile.get('shared_stories_count') ? 'NB-disabled' : '')
}, 'Preview'))
]); ]);
} else { } else {
$actions = $.make('div', { className: 'NB-profile-badge-action-buttons' }, [ $actions = $.make('div', { className: 'NB-profile-badge-action-buttons' }, [

View file

@ -20,8 +20,10 @@ NEWSBLUR.Views.Sidebar = Backbone.View.extend({
var show_folder_counts = NEWSBLUR.assets.preference('folder_counts'); var show_folder_counts = NEWSBLUR.assets.preference('folder_counts');
var collapsed = _.contains(NEWSBLUR.Preferences.collapsed_folders, 'river_blurblog'); var collapsed = _.contains(NEWSBLUR.Preferences.collapsed_folders, 'river_blurblog');
if (collapsed || show_folder_counts) { if (collapsed) {
this.show_collapsed_river_blurblog_count(options); this.show_collapsed_river_blurblog_count(options);
} else if (show_folder_counts) {
this.show_counts(options);
} }
return collapsed; return collapsed;
@ -51,6 +53,11 @@ NEWSBLUR.Views.Sidebar = Backbone.View.extend({
}); });
} }
this.show_counts(options);
},
show_counts: function(options) {
var $header = this.$('.NB-feeds-header-river-blurblogs');
var $counts = new NEWSBLUR.Views.FolderCount({ var $counts = new NEWSBLUR.Views.FolderCount({
collection: NEWSBLUR.assets.social_feeds collection: NEWSBLUR.assets.social_feeds
}).render().$el; }).render().$el;