Fixing feed exception dialog to actually reload feeds on the page.

This commit is contained in:
Samuel Clay 2012-02-23 14:03:11 -08:00
parent 6c7034343b
commit f3e2876ea2
4 changed files with 14 additions and 16 deletions

View file

@ -274,7 +274,7 @@ def load_feeds_flat(request):
data = dict(flat_folders=flat_folders, feeds=feeds, user=user.username, iphone_version=iphone_version) data = dict(flat_folders=flat_folders, feeds=feeds, user=user.username, iphone_version=iphone_version)
return data return data
@ratelimit(minutes=1, requests=10) @ratelimit(minutes=1, requests=20)
@json.json_view @json.json_view
def refresh_feeds(request): def refresh_feeds(request):
start = datetime.datetime.utcnow() start = datetime.datetime.utcnow()

View file

@ -856,7 +856,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
var pre_callback = function(data) { var pre_callback = function(data) {
// NEWSBLUR.log(['save_exception_change_feed_link pre_callback', feed_id, feed_link, data]); // NEWSBLUR.log(['save_exception_change_feed_link pre_callback', feed_id, feed_link, data]);
self.post_refresh_feeds(data, callback); self.post_refresh_feeds(data, callback);
NEWSBLUR.reader.force_feed_refresh(feed_id, null, data.new_feed_id); NEWSBLUR.reader.force_feed_refresh(feed_id, data.new_feed_id);
}; };
if (NEWSBLUR.Globals.is_authenticated) { if (NEWSBLUR.Globals.is_authenticated) {
@ -875,7 +875,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
var pre_callback = function(data) { var pre_callback = function(data) {
// NEWSBLUR.log(['save_exception_change_feed_address pre_callback', feed_id, feed_address, data]); // NEWSBLUR.log(['save_exception_change_feed_address pre_callback', feed_id, feed_address, data]);
self.post_refresh_feeds(data, callback); self.post_refresh_feeds(data, callback);
NEWSBLUR.reader.force_feed_refresh(feed_id, null, data.new_feed_id); NEWSBLUR.reader.force_feed_refresh(feed_id, data.new_feed_id);
}; };
if (NEWSBLUR.Globals.is_authenticated) { if (NEWSBLUR.Globals.is_authenticated) {

View file

@ -1240,7 +1240,7 @@
<div class="feed_counts">\ <div class="feed_counts">\
<%= feed_counts_floater %>\ <%= feed_counts_floater %>\
</div>\ </div>\
<img class="feed_favicon" src="<%= $.favicon(feed.favicon, true) %>">\ <img class="feed_favicon" src="<%= $.favicon(feed.favicon, !!favicons_downloaded) %>">\
<span class="feed_title">\ <span class="feed_title">\
<%= feed.feed_title %>\ <%= feed.feed_title %>\
<% if (type == "story") { %>\ <% if (type == "story") { %>\
@ -1272,7 +1272,8 @@
unread_class : unread_class, unread_class : unread_class,
exception_class : exception_class, exception_class : exception_class,
toplevel : depth == 0, toplevel : depth == 0,
list_type : type == 'feed' ? 'li' : 'div' list_type : type == 'feed' ? 'li' : 'div',
favicons_downloaded : this.flags['favicons_downloaded']
}); });
return $feed; return $feed;
@ -5216,7 +5217,7 @@
var $feed = this.find_feed_in_feed_list(feed_id); var $feed = this.find_feed_in_feed_list(feed_id);
$feed.addClass('NB-feed-unfetched').removeClass('NB-feed-exception'); $feed.addClass('NB-feed-unfetched').removeClass('NB-feed-exception');
this.model.save_exception_retry(feed_id, _.bind(this.force_feed_refresh, this, feed_id, $feed), this.show_stories_error); this.model.save_exception_retry(feed_id, _.bind(this.force_feed_refresh, this, feed_id), this.show_stories_error);
}, },
setup_socket_realtime_unread_counts: function(force) { setup_socket_realtime_unread_counts: function(force) {
@ -5275,10 +5276,10 @@
}, refresh_interval); }, refresh_interval);
}, },
force_feed_refresh: function(feed_id, $feed, new_feed_id) { force_feed_refresh: function(feed_id, new_feed_id) {
var self = this; var self = this;
feed_id = feed_id || this.active_feed; feed_id = feed_id || this.active_feed;
$feed = $feed || this.find_feed_in_feed_list(feed_id); var $feed = this.find_feed_in_feed_list(feed_id);
new_feed_id = new_feed_id || feed_id; new_feed_id = new_feed_id || feed_id;
this.force_feeds_refresh(function(feeds) { this.force_feeds_refresh(function(feeds) {

View file

@ -223,15 +223,14 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
}, },
save_retry_feed: function() { save_retry_feed: function() {
var self = this;
var $loading = $('.NB-modal-loading', this.$modal); var $loading = $('.NB-modal-loading', this.$modal);
$loading.addClass('NB-active'); $loading.addClass('NB-active');
var feed_id = this.feed_id;
$('.NB-modal-submit-retry', this.$modal).addClass('NB-disabled').attr('value', 'Fetching...'); $('.NB-modal-submit-retry', this.$modal).addClass('NB-disabled').attr('value', 'Fetching...');
this.model.save_exception_retry(this.feed_id, function() { this.model.save_exception_retry(feed_id, function() {
// NEWSBLUR.reader.flags['has_unfetched_feeds'] = true; NEWSBLUR.reader.force_feed_refresh(feed_id);
// NEWSBLUR.reader.force_instafetch_stories(self.feed_id);
$.modal.close(); $.modal.close();
}); });
}, },
@ -261,8 +260,7 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
if (feed_address.length) { if (feed_address.length) {
this.model.save_exception_change_feed_address(feed_id, feed_address, function(code) { this.model.save_exception_change_feed_address(feed_id, feed_address, function(code) {
// NEWSBLUR.reader.flags['has_unfetched_feeds'] = true; NEWSBLUR.reader.force_feed_refresh(feed_id);
// NEWSBLUR.reader.load_feeds();
$.modal.close(); $.modal.close();
}); });
} }
@ -279,8 +277,7 @@ _.extend(NEWSBLUR.ReaderFeedException.prototype, {
if (feed_link.length) { if (feed_link.length) {
this.model.save_exception_change_feed_link(feed_id, feed_link, function(code) { this.model.save_exception_change_feed_link(feed_id, feed_link, function(code) {
// NEWSBLUR.reader.flags['has_unfetched_feeds'] = true; NEWSBLUR.reader.force_feed_refresh(feed_id);
// NEWSBLUR.reader.load_feeds();
$.modal.close(); $.modal.close();
}); });
} }