Clearing logs and moving to longer refresh interval for dashboard stories.

This commit is contained in:
Samuel Clay 2017-01-11 12:33:52 -08:00
parent b548e9c7ff
commit b6c29b4bcc
5 changed files with 27 additions and 12 deletions

View file

@ -19,7 +19,7 @@ NEWSBLUR.Models.Feed = Backbone.Model.extend({
change_counts: function(data, count, options) {
options = options || {};
console.log(["change_counts", data, count, options]);
// console.log(["change_counts", data, count, options]);
this.update_folder_counts();
if (this.get('selected') && options.refresh_feeds) {
@ -293,6 +293,9 @@ NEWSBLUR.Collections.Feeds = Backbone.Collection.extend({
_.each(data.feeds, function(feed) {
feed.selected = false;
});
this.ensure_authenticated(data);
return data.feeds;
},
@ -302,6 +305,15 @@ NEWSBLUR.Collections.Feeds = Backbone.Collection.extend({
});
},
ensure_authenticated: function(data) {
if (!NEWSBLUR.Globals.is_authenticated) return;
if (_.isUndefined(data.authenticated)) return;
if (NEWSBLUR.Globals.is_authenticated != data.authenticated) {
console.log(['Woah! Lost auth cookie, letting user know...']);
NEWSBLUR.reader.show_authentication_lost();
}
},
// ==================
// = Model Managers =
// ==================

View file

@ -13,7 +13,7 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
},
select_story: function(story, selected) {
console.log(['select_story', this, this.collection, story, selected]);
// console.log(['select_story', this, this.collection, story, selected]);
if (this.collection) this.collection.detect_selected_story(this, selected);
},
@ -550,7 +550,7 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
detect_selected_story: function(selected_story, selected) {
if (selected) {
console.log(['detect_selected_story', selected, selected_story, this.active_story, this == NEWSBLUR.assets.stories ? "stories" : "dashboard"]);
// console.log(['detect_selected_story', selected, selected_story, this.active_story, this == NEWSBLUR.assets.stories ? "stories" : "dashboard"]);
this.deselect_other_stories(selected_story);
this.active_story = selected_story;
NEWSBLUR.reader.active_story = selected_story;

View file

@ -722,7 +722,7 @@
var story_id = this.flags['select_story_in_feed'];
var story = NEWSBLUR.assets.stories.get(story_id);
if (!story) story = NEWSBLUR.assets.stories.get_by_story_hash(story_id);
NEWSBLUR.log(['select_story_in_feed', story_id, story, this.story_view, this.counts['select_story_in_feed'], this.flags['no_more_stories']]);
// NEWSBLUR.log(['select_story_in_feed', story_id, story, this.story_view, this.counts['select_story_in_feed'], this.flags['no_more_stories']]);
if (story) {
this.counts['select_story_in_feed'] = 0;

View file

@ -49,14 +49,15 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
// ===========
setup_dashboard_refresh: function() {
if (NEWSBLUR.Globals.debug) return;
// if (NEWSBLUR.Globals.debug) return;
// Reload dashboard graphs every 10 minutes.
// Reload dashboard graphs every N minutes.
// var reload_interval = NEWSBLUR.Globals.is_staff ? 60*1000 : 10*60*1000;
var reload_interval = 15*60*1000;
var reload_interval = 60*60*1000;
// console.log(['setup_dashboard_refresh', this.refresh_interval]);
clearInterval(this.refresh_interval);
this.refresh_interval = setInterval(_.bind(function() {
clearTimeout(this.refresh_interval);
this.refresh_interval = setTimeout(_.bind(function() {
this.load_stories();
}, this), reload_interval * (Math.random() * (1.25 - 0.75) + 0.75));
},
@ -78,6 +79,8 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
this.story_titles.show_loading();
NEWSBLUR.assets.fetch_dashboard_stories(this.active_feed, feeds, this.page,
_.bind(this.post_load_stories, this), NEWSBLUR.app.taskbar_info.show_stories_error);
this.setup_dashboard_refresh();
},
post_load_stories: function() {
@ -118,7 +121,7 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
},
check_read_stories: function(story, attr) {
console.log(['story read', story, story.get('story_hash'), story.get('read_status'), attr]);
// console.log(['story read', story, story.get('story_hash'), story.get('read_status'), attr]);
if (!_.contains(this.cache.story_hashes, story.get('story_hash'))) return;
var dashboard_story = NEWSBLUR.assets.dashboard_stories.get_by_story_hash(story.get('story_hash'));
if (!dashboard_story) {

View file

@ -557,7 +557,7 @@ NEWSBLUR.Views.StoryListView = Backbone.View.extend({
},
check_feed_view_scrolled_to_bottom: function(model, selected) {
console.log(['check_feed_view_scrolled_to_bottom', model, selected]);
// console.log(['check_feed_view_scrolled_to_bottom', model, selected]);
if (!_.contains(['split', 'full'], NEWSBLUR.assets.view_setting(NEWSBLUR.reader.active_feed, 'layout'))) return;
if (NEWSBLUR.assets.preference('feed_view_single_story')) return;
if (NEWSBLUR.assets.flags['no_more_stories']) return;