mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Fixing bug where you could not traverse stories after training a story into a hidden score. Thanks to @afita for the amazing discovery.
This commit is contained in:
parent
82d9a5ae38
commit
11f5fadc9d
2 changed files with 14 additions and 7 deletions
|
@ -186,7 +186,7 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
|
|||
score = _.isUndefined(score) ? NEWSBLUR.reader.get_unread_view_score() : score;
|
||||
|
||||
return this.select(function(story) {
|
||||
return story.score() >= score;
|
||||
return story.score() >= score || story.get('visible');
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -195,7 +195,7 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
|
|||
score = _.isUndefined(score) ? NEWSBLUR.reader.get_unread_view_score() : score;
|
||||
|
||||
return this.select(function(story) {
|
||||
var visible = story.score() >= score;
|
||||
var visible = story.score() >= score || story.get('visible');
|
||||
var same_story = include_active_story && story.id == active_story_id;
|
||||
var read = !!story.get('read_status');
|
||||
|
||||
|
@ -207,7 +207,7 @@ NEWSBLUR.Collections.Stories = Backbone.Collection.extend({
|
|||
score = _.isUndefined(score) ? NEWSBLUR.reader.get_unread_view_score() : score;
|
||||
|
||||
return this.select(function(story) {
|
||||
return story.score() < score;
|
||||
return story.score() < score && !story.get('visible');
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
this.model.bind('change:selected', this.toggle_selected, this);
|
||||
this.model.bind('change:starred', this.toggle_starred, this);
|
||||
this.model.bind('change:intelligence', this.render_header, this);
|
||||
this.model.bind('change:intelligence', this.toggle_score, this);
|
||||
|
||||
// Binding directly instead of using event delegation. Need for speed.
|
||||
// this.$el.bind('mouseenter', this.mouseenter);
|
||||
|
@ -53,6 +54,7 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
this.$el.html(this.template(params));
|
||||
this.toggle_classes();
|
||||
this.toggle_read_status();
|
||||
this.toggle_score();
|
||||
this.generate_gradients();
|
||||
this.render_comments();
|
||||
|
||||
|
@ -199,7 +201,7 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
toggle_classes: function() {
|
||||
var changes = this.model.changedAttributes();
|
||||
var onlySelected = changes && _.all(_.keys(changes), function(change) {
|
||||
return _.contains(['selected', 'read', 'intelligence'], change);
|
||||
return _.contains(['selected', 'read', 'intelligence', 'visible'], change);
|
||||
});
|
||||
|
||||
if (onlySelected) return;
|
||||
|
@ -218,8 +220,6 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
this.$el.toggleClass('NB-river-story', NEWSBLUR.reader.flags.river_view);
|
||||
this.$el.toggleClass('NB-story-starred', !!story.get('starred'));
|
||||
this.$el.toggleClass('NB-story-shared', !!story.get('shared'));
|
||||
this.$el.removeClass('NB-story-negative NB-story-neutral NB-story-postiive')
|
||||
.addClass('NB-story-'+story.score_name(score));
|
||||
|
||||
if (unread_view > score) {
|
||||
this.$el.css('display', 'none');
|
||||
|
@ -240,6 +240,13 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
this.$el.toggleClass('read', !!this.model.get('read_status'));
|
||||
},
|
||||
|
||||
toggle_score: function() {
|
||||
var story = this.model;
|
||||
|
||||
this.$el.removeClass('NB-story-negative NB-story-neutral NB-story-postiive')
|
||||
.addClass('NB-story-'+story.score_name(story.score()));
|
||||
},
|
||||
|
||||
toggle_selected: function(model, selected, options) {
|
||||
this.$el.toggleClass('NB-selected', !!this.model.get('selected'));
|
||||
|
||||
|
@ -392,7 +399,7 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
|
|||
} else if (score == -1) {
|
||||
data['dislike_'+classifier_type] = value;
|
||||
}
|
||||
|
||||
this.model.set('visible', true, {silent: true});
|
||||
NEWSBLUR.assets.classifiers[feed_id][classifier_type+'s'][value] = score;
|
||||
NEWSBLUR.assets.recalculate_story_scores(feed_id, {story_view: this});
|
||||
NEWSBLUR.assets.save_classifier(data, function(resp) {
|
||||
|
|
Loading…
Add table
Reference in a new issue