mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Adding update_counts to /feeds API endpoint, to force a recalculation of feed unread counts (WARNING: slower than calling /feeds then /refresh_feeds).
This commit is contained in:
parent
7c92c92f1a
commit
936774b654
4 changed files with 15 additions and 3 deletions
|
@ -159,6 +159,7 @@ def load_feeds(request):
|
|||
not_yet_fetched = False
|
||||
include_favicons = request.REQUEST.get('include_favicons', False)
|
||||
flat = request.REQUEST.get('flat', False)
|
||||
update_counts = request.REQUEST.get('update_counts', False)
|
||||
|
||||
if flat: return load_feeds_flat(request)
|
||||
|
||||
|
@ -175,6 +176,8 @@ def load_feeds(request):
|
|||
|
||||
for sub in user_subs:
|
||||
pk = sub.feed.pk
|
||||
if update_counts:
|
||||
sub.calculate_feed_scores(silent=True)
|
||||
feeds[pk] = sub.canonical(include_favicon=include_favicons)
|
||||
if feeds[pk].get('not_yet_fetched'):
|
||||
not_yet_fetched = True
|
||||
|
|
|
@ -4933,8 +4933,8 @@
|
|||
this.model.save_exception_retry(feed_id, _.bind(this.force_feed_refresh, this, feed_id, $feed));
|
||||
},
|
||||
|
||||
setup_socket_realtime_unread_counts: function() {
|
||||
if (!this.socket && NEWSBLUR.Globals.is_premium && NEWSBLUR.Globals.username == 'samuel') {
|
||||
setup_socket_realtime_unread_counts: function(force) {
|
||||
if (force && !this.socket) {
|
||||
this.socket = this.socket || io.connect('http://' + window.location.hostname + ':8888');
|
||||
|
||||
// this.socket.refresh_feeds = _.debounce(_.bind(this.force_feeds_refresh, this), 1000*10);
|
||||
|
|
|
@ -183,7 +183,7 @@ COMPRESS_JS = {
|
|||
'js/jquery.fieldselection.js',
|
||||
'js/jquery.flot.js',
|
||||
'js/jquery.tipsy.js',
|
||||
'js/socket.io-client.0.8.7.js',
|
||||
# 'js/socket.io-client.0.8.7.js',
|
||||
'js/underscore.js',
|
||||
'js/underscore.string.js',
|
||||
'js/newsblur/reader_utils.js',
|
||||
|
|
|
@ -84,6 +84,15 @@
|
|||
optional: true
|
||||
default: "false"
|
||||
example: "true/false"
|
||||
- key: update_counts
|
||||
desc: >
|
||||
Forces recalculation of unread counts on all feeds. The preferred method is
|
||||
to call this endpoint without updated counts, then call refresh_feeds to get
|
||||
updated counts. That way you can quickly show the user's feeds, then update
|
||||
the counts. Turning this option on will lead to a slower load-time.
|
||||
optional: true
|
||||
default: "false"
|
||||
example: "true/false"
|
||||
|
||||
- url: /reader/favicons
|
||||
method: GET
|
||||
|
|
Loading…
Add table
Reference in a new issue