aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyaggr3g470r/templates/layout.html2
-rw-r--r--pyaggr3g470r/views/feed.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/pyaggr3g470r/templates/layout.html b/pyaggr3g470r/templates/layout.html
index 93d36096..9b767649 100644
--- a/pyaggr3g470r/templates/layout.html
+++ b/pyaggr3g470r/templates/layout.html
@@ -67,6 +67,8 @@
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ _('Feed') }} <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ url_for("feeds.update", action="read") }}">{{ _('Mark all as read') }}</a></li>
+ <li><a href="{{ url_for("feeds.update", action="read", nb_days="1") }}">{{ _('Mark all as read older than yesterday') }}</a></li>
+ <li><a href="{{ url_for("feeds.update", action="read", nb_days="10") }}">{{ _('Mark all as read older than 10 days') }}</a></li>
<li role="presentation" class="divider"></li>
<li><a href="{{ url_for("inactives") }}">{{ _('Inactive') }}</a></li>
<li><a href="{{ url_for("history") }}">{{ _('History') }}</a></li>
diff --git a/pyaggr3g470r/views/feed.py b/pyaggr3g470r/views/feed.py
index afb51903..bdb4f046 100644
--- a/pyaggr3g470r/views/feed.py
+++ b/pyaggr3g470r/views/feed.py
@@ -3,7 +3,7 @@
import base64
import requests.exceptions
from hashlib import md5
-from datetime import datetime
+from datetime import datetime, timedelta
from sqlalchemy import desc
from werkzeug.exceptions import BadRequest
@@ -131,6 +131,12 @@ def bookmarklet():
def update(action, feed_id=None):
readed = action == 'read'
filters = {'readed__ne': readed}
+
+ nb_days = request.args.get('nb_days', None)
+ if nb_days is not None:
+ delete_before = datetime.now() - timedelta(days=int(nb_days))
+ filters['date__lt'] = delete_before
+
if feed_id:
filters['feed_id'] = feed_id
ArticleController(g.user.id).update(filters, {'readed': readed})
bgstack15