Fixing following bug due to array truncation of following list.

This commit is contained in:
Samuel Clay 2012-07-12 01:21:09 -07:00
parent bfa00d8bd4
commit 75337a65fb
4 changed files with 7 additions and 4 deletions

View file

@ -317,7 +317,6 @@ class MSocialProfile(mongo.Document):
'bio': self.bio,
'location': self.location,
'website': self.website,
'subscription_count': self.subscription_count,
'shared_stories_count': self.shared_stories_count,
'following_count': self.following_count,
'follower_count': self.follower_count,
@ -344,6 +343,7 @@ class MSocialProfile(mongo.Document):
params['followers_everybody'] = followers_everybody[:48]
params['following_youknow'] = following_youknow[:48]
params['following_everybody'] = following_everybody[:48]
params['following'] = self.is_followed_by_user(common_follows_with_user)
return params
@ -416,6 +416,9 @@ class MSocialProfile(mongo.Document):
def is_following_user(self, user_id):
return user_id in self.following_user_ids
def is_followed_by_user(self, user_id):
return user_id in self.follower_user_ids
def unfollow_user(self, user_id):
r = redis.Redis(connection_pool=settings.REDIS_POOL)

View file

@ -1044,7 +1044,7 @@ header {
padding: 1px 0;
text-align: center;
margin: 0 auto 36px;
width: 800px;
max-width: 800px;
border-radius: 8px;
overflow: hidden;
}

View file

@ -326,7 +326,7 @@ NEWSBLUR.Views.OriginalTabView = Backbone.View.extend({
NEWSBLUR.log(['Original view entirely loaded', _.keys(self.cache.iframe_stories).length + " stories", this.counts['positions_timer']/1000 + " sec delay"]);
this.counts['positions_timer'] = Math.max(this.counts['positions_timer']*2, 1000);
this.counts['positions_timer'] = Math.min(60*1000, Math.max(this.counts['positions_timer']*2, 1*1000));
clearTimeout(this.flags['next_fetch']);
this.flags['next_fetch'] = _.delay(_.bind(this.fetch_story_locations_in_story_frame, this),
this.counts['positions_timer']);

View file

@ -72,7 +72,7 @@ NEWSBLUR.Views.SocialProfileBadge = Backbone.View.extend({
(!profile.get('shared_stories_count') ? 'NB-disabled' : '')
}, 'Edit Profile'))
]);
} else if (_.contains(NEWSBLUR.reader.model.user_profile.get('following_user_ids'), profile.get('user_id'))) {
} else if (profile.get('following')) {
$actions = $.make('div', {
className: 'NB-profile-badge-action-unfollow NB-profile-badge-action-buttons NB-modal-submit-button NB-modal-submit-grey'
}, 'Following');