aboutsummaryrefslogtreecommitdiff
path: root/src/web/views
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2016-01-23 03:21:41 +0100
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-26 23:47:09 +0100
commit94a18fbdecaa798d67a5bf7ad0f2b8ee4e0c7851 (patch)
treea5d3597db4c9c2af5062aba5270625776e6ee4cb /src/web/views
parentdisplaying error (diff)
downloadnewspipe-94a18fbdecaa798d67a5bf7ad0f2b8ee4e0c7851.tar.gz
newspipe-94a18fbdecaa798d67a5bf7ad0f2b8ee4e0c7851.tar.bz2
newspipe-94a18fbdecaa798d67a5bf7ad0f2b8ee4e0c7851.zip
meh, kinda works, sleep now
Diffstat (limited to 'src/web/views')
-rw-r--r--src/web/views/views.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/web/views/views.py b/src/web/views/views.py
index 1b079d9f..25788c42 100644
--- a/src/web/views/views.py
+++ b/src/web/views/views.py
@@ -266,17 +266,26 @@ def get_menu():
@app.route('/middle_panel')
@login_required
def get_middle_panel():
+ filters = {}
+ if request.args.get('filter') == 'unread':
+ filters['readed'] = False
+ elif request.args.get('filter') == 'liked':
+ filters['like'] = True
+ filter_type = request.args.get('filter_type')
+ if filter_type in {'feed', 'category'} and request.args.get('filter_id'):
+ filters[filter_type + '_id'] = int(request.args['filter_id'])
+
fd_hash = {feed.id: {'title': feed.title,
'icon_url': url_for('icon.icon', url=feed.icon_url)
if feed.icon_url else None}
for feed in FeedController(g.user.id).read()}
- articles = ArticleController(g.user.id).read(readed=False).order_by('date')
+ articles = ArticleController(g.user.id).read(**filters).order_by('-date')
return jsonify(**{'articles': [{'title': art.title, 'liked': art.like,
'read': art.readed, 'article_id': art.id,
'feed_id': art.feed_id, 'category_id': art.category_id or 0,
'feed_title': fd_hash[art.feed_id]['title'],
'icon_url': fd_hash[art.feed_id]['icon_url'],
- 'date': art.date} for art in articles]})
+ 'date': art.date} for art in articles.limit(1000)]})
@etag_match
bgstack15