mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Syncing read status on dashboard to river.
This commit is contained in:
parent
6232e902e3
commit
da754eca84
2 changed files with 20 additions and 1 deletions
|
@ -18,8 +18,12 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
|
|||
on_dashboard: true
|
||||
});
|
||||
this.page = 1;
|
||||
this.cache = {
|
||||
story_hashes: []
|
||||
};
|
||||
|
||||
NEWSBLUR.assets.feeds.bind('reset', _.bind(this.load_stories, this));
|
||||
NEWSBLUR.assets.stories.bind('change:read_status', this.check_read_stories, this);
|
||||
},
|
||||
|
||||
feeds: function() {
|
||||
|
@ -53,6 +57,7 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
|
|||
|
||||
post_load_stories: function() {
|
||||
this.fill_out();
|
||||
this.cache.story_hashes = NEWSBLUR.assets.dashboard_stories.pluck('story_hash');
|
||||
},
|
||||
|
||||
fill_out: function() {
|
||||
|
@ -68,6 +73,18 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
|
|||
this.story_titles.show_loading();
|
||||
NEWSBLUR.assets.fetch_dashboard_stories("river:", feeds, this.page,
|
||||
_.bind(this.post_load_stories, this), NEWSBLUR.app.taskbar_info.show_stories_error);
|
||||
},
|
||||
|
||||
check_read_stories: function(story) {
|
||||
console.log(['story read', story, story.get('story_hash'), story.get('read_status')]);
|
||||
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) {
|
||||
console.log(['Error: missing story on dashboard', story, this.cache.story_hashes]);
|
||||
return;
|
||||
}
|
||||
|
||||
dashboard_story.set('read_status', story.get('read_status'));
|
||||
}
|
||||
|
||||
});
|
|
@ -71,7 +71,8 @@
|
|||
{% if not user_profile.hide_getting_started %}
|
||||
{% render_getting_started %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if user.is_staff %}
|
||||
<div class="NB-module NB-module-river">
|
||||
<h5 class="NB-module-header">
|
||||
<div class="NB-module-river-settings NB-javascript"></div>
|
||||
|
@ -84,6 +85,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% render_features_module %}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue