mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixing next unread button in social feed.
This commit is contained in:
parent
05fce0124a
commit
790e87e723
2 changed files with 20 additions and 12 deletions
|
@ -93,7 +93,10 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
|
|||
if (delay || this.last_read_story_id == story.id || delay == 0) {
|
||||
var mark_read_fn = NEWSBLUR.assets.mark_story_as_read;
|
||||
var feed = NEWSBLUR.assets.get_feed(NEWSBLUR.reader.active_feed);
|
||||
if (feed.is_social()) {
|
||||
if (!feed) {
|
||||
feed = NEWSBLUR.assets.get_feed(story.get('story_feed_id'));
|
||||
}
|
||||
if (feed && feed.is_social()) {
|
||||
mark_read_fn = NEWSBLUR.assets.mark_social_story_as_read;
|
||||
}
|
||||
mark_read_fn.call(NEWSBLUR.assets, story, feed, _.bind(function(read) {
|
||||
|
@ -122,6 +125,10 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
|
|||
var active_feed = NEWSBLUR.assets.get_feed(NEWSBLUR.reader.active_feed);
|
||||
var story_feed = NEWSBLUR.assets.get_feed(story.get('story_feed_id'));
|
||||
|
||||
if (!active_feed) {
|
||||
// River of News does not have an active feed.
|
||||
active_feed = story_feed;
|
||||
}
|
||||
if (story.score() > 0) {
|
||||
var active_count = Math.max(active_feed.get('ps') + (options.unread?1:-1), 0);
|
||||
var story_count = Math.max(story_feed.get('ps') + (options.unread?1:-1), 0);
|
||||
|
@ -239,6 +246,7 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
|
|||
get_next_unread_story: function(options) {
|
||||
options = options || {};
|
||||
var visible_stories = this.visible_and_unread(options.score, true);
|
||||
console.log(["visible and unread", visible_stories, this, options.score]);
|
||||
if (!visible_stories.length) return;
|
||||
|
||||
if (!this.active_story) {
|
||||
|
|
|
@ -465,7 +465,7 @@
|
|||
show_next_unread_story: function() {
|
||||
var unread_count = this.get_unread_count(true);
|
||||
|
||||
// NEWSBLUR.log(['show_next_unread_story', unread_count, $current_story]);
|
||||
NEWSBLUR.log(['show_next_unread_story', unread_count]);
|
||||
|
||||
if (unread_count) {
|
||||
var next_story = NEWSBLUR.assets.stories.get_next_unread_story();
|
||||
|
@ -3255,19 +3255,11 @@
|
|||
var total = 0;
|
||||
var $folder;
|
||||
feed_id = feed_id || this.active_feed;
|
||||
var feed = this.model.get_feed(feed_id);
|
||||
|
||||
if (feed_id == 'starred') {
|
||||
// Umm, no. Not yet.
|
||||
} else if (this.flags['river_view']) {
|
||||
if (feed_id == 'river:') {
|
||||
$folder = this.$s.$feed_list;
|
||||
} else {
|
||||
$folder = $('li.folder.NB-selected');
|
||||
}
|
||||
var counts = this.list_feeds_with_unreads_in_folder($folder, true, visible_only);
|
||||
return _.reduce(counts, function(m, c) { return m + c; }, 0);
|
||||
} else {
|
||||
var feed = this.model.get_feed(feed_id);
|
||||
} else if (feed) {
|
||||
if (!visible_only) {
|
||||
total = feed.get('ng') + feed.get('nt') + feed.get('ps');
|
||||
} else {
|
||||
|
@ -3281,6 +3273,14 @@
|
|||
}
|
||||
}
|
||||
return total;
|
||||
} else if (this.flags['river_view']) {
|
||||
if (feed_id == 'river:') {
|
||||
$folder = this.$s.$feed_list;
|
||||
} else {
|
||||
$folder = $('li.folder.NB-selected');
|
||||
}
|
||||
var counts = this.list_feeds_with_unreads_in_folder($folder, true, visible_only);
|
||||
return _.reduce(counts, function(m, c) { return m + c; }, 0);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue