Merge branch 'master' into tagging

* master:
  Handling stats feed count for blurblog itself.
  Showing correct feed titles in blurblog stats.
  Fixing broken social stats.
This commit is contained in:
Samuel Clay 2013-08-15 17:09:19 -07:00
commit 1edf74b8f1
4 changed files with 17 additions and 4 deletions

View file

@ -33,7 +33,8 @@ urlpatterns = patterns('',
url(r'^stories/(?P<user_id>\w+)/(?P<username>[-\w]+)?/?$', views.load_social_stories, name='load-social-stories'),
url(r'^page/(?P<user_id>\w+)/(?P<username>[-\w]+)?/?$', views.load_social_page, name='load-social-page'),
url(r'^settings/(?P<social_user_id>\w+)/(?P<username>[-\w]+)?/?$', views.load_social_settings, name='load-social-settings'),
url(r'^statistics/(?P<social_user_id>\w+)/(?P<username>[-\w]+)?/?$', views.load_social_statistics, name='load-social-statistics'),
url(r'^statistics/(?P<social_user_id>\w+)/(?P<username>[-\w]+)/?$', views.load_social_statistics, name='load-social-statistics'),
url(r'^statistics/(?P<social_user_id>\w+)/?$', views.load_social_statistics, name='load-social-statistics'),
url(r'^mute_story/(?P<secret_token>\w+)/(?P<shared_story_id>\w+)?$', views.mute_story, name='social-mute-story'),
url(r'^(?P<username>[-\w]+)/?$', views.shared_stories_public, name='shared-stories-public'),
)

View file

@ -1286,6 +1286,13 @@ def load_social_statistics(request, social_user_id, username=None):
# Classifier counts
stats['classifier_counts'] = social_profile.feed_classifier_counts
# Feeds
feed_ids = [c['feed_id'] for c in stats['classifier_counts'].get('feed', [])]
feeds = Feed.objects.filter(pk__in=feed_ids).only('feed_title')
titles = dict([(f.pk, f.feed_title) for f in feeds])
for stat in stats['classifier_counts'].get('feed', []):
stat['feed_title'] = titles.get(stat['feed_id'], "")
logging.user(request, "~FBStatistics social: ~SB%s ~FG(%s subs)" % (
social_profile.user_id, social_profile.follower_count))

View file

@ -210,7 +210,12 @@ _.extend(NEWSBLUR.ReaderStatistics.prototype, {
var pos = counts.pos || 0;
var neg = counts.neg || 0;
var key = counts[facet];
if (facet == 'feed') {
if (facet == 'feed' && self.options.social_feed && counts['feed_id'] != 0) {
key = [$.make('div', [
$.make('img', { className: 'NB-modal-feed-image feed_favicon', src: $.favicon(counts['feed_id']) }),
$.make('span', { className: 'NB-modal-feed-title' }, counts['feed_title'])
])];
} else if (facet == 'feed') {
key = [$.make('div', [
$.make('img', { className: 'NB-modal-feed-image feed_favicon', src: $.favicon(self.feed) }),
$.make('span', { className: 'NB-modal-feed-title' }, self.feed.get('feed_title'))

View file

@ -248,14 +248,14 @@ NEWSBLUR.log = function(msg) {
},
favicon: function(feed, empty_on_missing) {
if (feed.get('favicon') && feed.get('favicon').length && feed.get('favicon').indexOf('data:image/png;base64,') != -1) return feed.get('favicon');
if (_.isNumber(feed)) return NEWSBLUR.URLs.favicon.replace('{id}', feed);
else if (feed.get('favicon') && feed.get('favicon').length && feed.get('favicon').indexOf('data:image/png;base64,') != -1) return feed.get('favicon');
else if (feed.get('favicon') && feed.get('favicon').length) return 'data:image/png;base64,' + feed.get('favicon');
else if (feed.get('favicon_url') && !empty_on_missing) return feed.get('favicon_url');
else if (feed.get('photo_url')) return feed.get('photo_url');
else if (_.string.include(feed.id, 'social:')) return NEWSBLUR.Globals.MEDIA_URL + 'img/reader/default_profile_photo.png';
else if (empty_on_missing) return 'data:image/png;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
else if (_.isNumber(feed.id)) return NEWSBLUR.URLs.favicon.replace('{id}', feed.id);
else if (_.isNumber(feed)) return NEWSBLUR.URLs.favicon.replace('{id}', feed);
else if (feed.get('favicon_url')) return feed.get('favicon_url');
return NEWSBLUR.Globals.MEDIA_URL + '/img/silk/circular/world.png';
},