Skip to content

Commit

Permalink
mark all as read which is ONLY shown in screen #28
Browse files Browse the repository at this point in the history
  • Loading branch information
tribela committed Jan 21, 2014
1 parent 06a17b9 commit f00ca4f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion earthreader/web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ def category_entries(category_id):
title=category_id.split('/')[-1][1:] or app.config['ALLFEED'],
entries=entries,
read_url=url_for('read_all_entries', category_id=category_id,
#FIXME: use Entry.updated_at instead of from json data.
last_updated=entries[0]['updated'],
_external=True),
next_url=next_url
)
Expand Down Expand Up @@ -845,12 +847,16 @@ def read_all_entries(category_id='', feed_id=None):
cursor = Cursor(category_id)
feed_ids = [sub.feed_id for sub in cursor.recursive_subscriptions]

codec = Rfc3339()
last_updated = codec.decode(request.args.get('last_updated'))

for feed_id in feed_ids:
try:
with get_stage() as stage:
feed = stage.feeds[feed_id]
for entry in feed.entries:
entry.read = True
if entry.updated_at <= last_updated:
entry.read = True
stage.feeds[feed_id] = feed
except KeyError:
if feed_id:
Expand Down

0 comments on commit f00ca4f

Please sign in to comment.