Only show active feeds in dashboard river. Also link dashboard river title and icon.

This commit is contained in:
Samuel Clay 2021-03-04 10:24:17 -05:00
parent 889d37cebb
commit dbec2708da
9 changed files with 32 additions and 8 deletions

View file

@ -210,10 +210,12 @@ class MUserFeedNotification(mongo.Document):
def push_story_notification(self, story, classifiers, usersub):
story_score = self.story_score(story, classifiers)
if self.is_focus and story_score <= 0:
logging.debug("Is focus, but story is hidden")
if settings.DEBUG:
logging.debug("Is focus, but story is hidden")
return False
elif story_score < 0:
logging.debug("Is unread, but story is hidden")
if settings.DEBUG:
logging.debug("Is unread, but story is hidden")
return False
user = User.objects.get(pk=self.user_id)

View file

@ -142,7 +142,7 @@ class UserSubscription(models.Model):
unread_stories_key = 'U:%s:%s' % (user_id, feed_id)
unread_ranked_stories_key = 'zU:%s:%s' % (user_id, feed_id)
expire_unread_stories_key = False
max_score = current_time
if read_filter == 'unread':
# +1 for the intersection b/w zF and F, which carries an implicit score of 1.

View file

@ -3,6 +3,7 @@ from django.conf import settings
from django.contrib.auth.models import User
from apps.statistics.models import MStatistics
from apps.rss_feeds.models import Feed
from apps.reader.models import UserSubscription
from optparse import make_option
from utils import feed_fetcher
from utils.management_functions import daemonize
@ -49,7 +50,8 @@ class Command(BaseCommand):
if options['force']:
feeds = Feed.objects.all()
elif options['username']:
feeds = Feed.objects.filter(subscribers__user=User.objects.get(username=options['username']))
usersubs = UserSubscription.objects.filter(user=User.objects.get(username=options['username']), active=True)
feeds = Feed.objects.filter(pk__in=usersubs.values('feed_id'))
elif options['feed']:
feeds = Feed.objects.filter(pk=options['feed'])
else:

View file

@ -3059,6 +3059,7 @@ class MStarredStoryCounts(mongo.Document):
'count': c.count,
'is_highlights': c.is_highlights,
'feed_address': c.rss_url,
'active': True,
'feed_id': c.feed_id}
for c in counts],
key=lambda x: (x.get('tag', '') or '').lower())
@ -3211,6 +3212,7 @@ class MSavedSearch(mongo.Document):
searches = sorted([{'query': s.query,
'feed_address': s.rss_url,
'feed_id': s.feed_id,
'active': True,
} for s in searches],
key=lambda x: (x.get('query', '') or '').lower())
return searches

View file

@ -370,6 +370,7 @@ class MSocialProfile(mongo.Document):
'feed_link': self.blurblog_url,
'protected': self.protected,
'private': self.private,
'active': True,
}
if not compact:
params.update({
@ -824,6 +825,7 @@ class MSocialSubscription(mongo.Document):
needs_unread_recalc = mongo.BooleanField(default=False)
feed_opens = mongo.IntField(default=0)
is_trained = mongo.BooleanField(default=False)
active = mongo.BooleanField(default=True)
meta = {
'collection': 'social_subscription',
@ -903,6 +905,7 @@ class MSocialSubscription(mongo.Document):
def canonical(self):
return {
'user_id': self.user_id,
'active': self.active,
'subscription_user_id': self.subscription_user_id,
'nt': self.unread_count_neutral,
'ps': self.unread_count_positive,

View file

@ -6952,6 +6952,7 @@ form.opml_import_form input {
}
.NB-module-river .NB-module-river-favicon {
display: inline-block;
cursor: pointer;
}
.NB-module-river .NB-module-river-favicon img {
width: 16px;
@ -6961,6 +6962,7 @@ form.opml_import_form input {
}
.NB-module-river .NB-module-river-title {
display: inline-block;
cursor: pointer;
}
.NB-module-river .NB-view-river {
box-shadow: 0 1px 2px rgba(0,0,0,0.1);

View file

@ -165,6 +165,7 @@ NEWSBLUR.utils = {
var make_feed_option = function(feed) {
if (!feed.get('feed_title')) return;
if (!feed.get('active')) return;
var prefix = 'feed:';
if (feed.is_starred()) prefix = '';
else if (feed.is_social()) prefix = '';

View file

@ -2,7 +2,9 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
events: {
"click .NB-module-search-add-url" : "add_url",
"click .NB-feedbar-options" : "open_options_popover"
"click .NB-feedbar-options" : "open_options_popover",
"click .NB-module-river-favicon" : "reload",
"click .NB-module-river-title" : "open_river"
},
initialize: function () {
@ -116,6 +118,10 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
console.log(['River feeds', river_id, feeds.length, feeds]);
return feeds;
},
open_river: function () {
this.open_story();
},
// ===========
// = Refresh =
@ -149,6 +155,10 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
this.story_titles.render();
},
reload: function () {
this.load_stories();
},
load_stories: function(options) {
options = _.extend({
global_feed: this.options.global_feed,
@ -253,7 +263,7 @@ NEWSBLUR.Views.DashboardRiver = Backbone.View.extend({
var river_id = this.model.get('river_id');
var options = {
dashboard_transfer: this.options.dashboard_stories,
story_id: story.id
story_id: story && story.id
};
console.log(['Opening dashboard story', story, this.options]);

View file

@ -31,7 +31,7 @@ NEWSBLUR.Views.FeedSelector = Backbone.View.extend({
this.$el.show();
$input.val('');
$input.focus();
console.log(["Focus on feed selector", $input]);
NEWSBLUR.app.feed_list.options.feed_chooser = true;
NEWSBLUR.assets.feeds.trigger('reset', {feed_selector: true});
$feed_list.addClass('NB-selector-active');
@ -44,6 +44,8 @@ NEWSBLUR.Views.FeedSelector = Backbone.View.extend({
if (NEWSBLUR.reader.flags['sidebar_closed']) {
NEWSBLUR.reader.layout.outerLayout.show('west', true);
}
$input.focus();
},
hide_feed_selector: function() {
@ -182,4 +184,4 @@ NEWSBLUR.Views.FeedSelector = Backbone.View.extend({
return false;
}
});
});