From c98c76bc7b50a03d90de3c3ae8bf6ea24857cba4 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 1 Jun 2017 23:25:36 +0200 Subject: Display only recent bookmarks when disconnected. --- src/web/templates/bookmarks.html | 2 +- src/web/views/bookmark.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/web') diff --git a/src/web/templates/bookmarks.html b/src/web/templates/bookmarks.html index 66c6df52..a3ec4580 100644 --- a/src/web/templates/bookmarks.html +++ b/src/web/templates/bookmarks.html @@ -39,7 +39,7 @@ {{ pagination.links }} -
+
    diff --git a/src/web/views/bookmark.py b/src/web/views/bookmark.py index 477ca5fc..e7a4181e 100644 --- a/src/web/views/bookmark.py +++ b/src/web/views/bookmark.py @@ -27,6 +27,7 @@ __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "AGPLv3" import logging +import datetime from werkzeug.exceptions import BadRequest from flask import Blueprint, render_template, flash, \ @@ -64,7 +65,6 @@ def list_(per_page, status='all'): query_regex = '%' + query + '%' filters['__or__'] = {'title__ilike': query_regex, 'description__ilike': query_regex} - if current_user.is_authenticated: # query for the bookmarks of the authenticated user user_id = current_user.id @@ -83,6 +83,10 @@ def list_(per_page, status='all'): pass else: # query for the shared bookmarks (of all users) + head_titles = [gettext("Recent bookmarks")] + not_created_before = datetime.datetime.today() - \ + datetime.timedelta(days=900) + filters['time__gt'] = not_created_before # only "recent" bookmarks filters['shared'] = True bookmarks = BookmarkController(user_id) \ -- cgit