Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Trying to fix the unread counts ghosting issue by forcing an instant …

…unread count refetch of active/selected feeds. This may work!
  • Loading branch information...
commit c389b9bf0e3aea11e06f155a1b2f948b03b9766b 1 parent 3bb1c95
@samuelclay authored
View
18 media/js/newsblur/common/assetmodel.js
@@ -636,7 +636,9 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
var self = this;
var pre_callback = function(data) {
- self.post_refresh_feeds(data, callback);
+ self.post_refresh_feeds(data, callback, {
+ 'refresh_feeds': true
+ });
};
var data = {};
@@ -666,7 +668,9 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
var self = this;
var pre_callback = function(data) {
- self.post_refresh_feeds(data, callback);
+ self.post_refresh_feeds(data, callback, {
+ 'refresh_feeds': false
+ });
};
if (NEWSBLUR.Globals.is_authenticated || feed_id) {
@@ -676,9 +680,11 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
}
},
- post_refresh_feeds: function(data, callback) {
+ post_refresh_feeds: function(data, callback, options) {
if (!data.feeds) return;
+ options = options || {};
+
_.each(data.feeds, _.bind(function(feed, feed_id) {
var existing_feed = this.feeds.get(feed_id);
if (!existing_feed) return;
@@ -700,7 +706,11 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
});
}
- existing_feed.set(feed);
+ if (existing_feed.get('selected') && options.refresh_feeds) {
+ existing_feed.force_update_counts();
+ } else {
+ existing_feed.set(feed, options);
+ }
}, this));
_.each(data.social_feeds, _.bind(function(feed) {
View
21 media/js/newsblur/models/feeds.js
@@ -3,9 +3,9 @@ NEWSBLUR.Models.Feed = Backbone.Model.extend({
initialize: function() {
_.bindAll(this, 'on_change', 'delete_feed', 'update_folder_counts');
// this.bind('change', this.on_change);
- this.bind('change:ps', this.update_folder_counts);
- this.bind('change:nt', this.update_folder_counts);
- this.bind('change:ng', this.update_folder_counts);
+ this.bind('change:ps', this.change_counts);
+ this.bind('change:nt', this.change_counts);
+ this.bind('change:ng', this.change_counts);
this.bind('change:selected', this.update_folder_visibility);
this.views = [];
this.folders = [];
@@ -17,6 +17,21 @@ NEWSBLUR.Models.Feed = Backbone.Model.extend({
}
},
+ change_counts: function(data, count, options) {
+ options = options || {};
+ console.log(["change_counts", data, count, options]);
+ this.update_folder_counts();
+
+ if (this.get('selected') && options.refresh_feeds) {
+ console.log(["Selected feed count change", this]);
+ NEWSBLUR.reader.feed_unread_count(this.id);
+ }
+ },
+
+ force_update_counts: function() {
+ NEWSBLUR.reader.feed_unread_count(this.id);
+ },
+
update_folder_counts: function() {
_.each(this.folders, function(folder) {
folder.trigger('change:counts');
View
2  settings.py
@@ -22,6 +22,7 @@
SERVER_EMAIL = 'server@newsblur.com'
HELLO_EMAIL = 'hello@newsblur.com'
NEWSBLUR_URL = 'http://www.newsblur.com'
+SECRET_KEY = 'YOUR_SECRET_KEY'
# ===========================
# = Directory Declaractions =
@@ -66,7 +67,6 @@
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/admin/'
-SECRET_KEY = 'YOUR_SECRET_KEY'
# EMAIL_BACKEND = 'django_mailgun.MailgunBackend'
EMAIL_BACKEND = 'django_ses.SESBackend'
CIPHER_USERNAMES = False
Please sign in to comment.
Something went wrong with that request. Please try again.