aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2017-05-26 23:10:17 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2017-05-26 23:10:17 +0200
commitbd388e6db9a4f914f623f0d27a981ab494cbda85 (patch)
treef0b9e77b2f045e06f908a7d324234614e58b5ba1 /src
parentUpdated translations. (diff)
downloadnewspipe-bd388e6db9a4f914f623f0d27a981ab494cbda85.tar.gz
newspipe-bd388e6db9a4f914f623f0d27a981ab494cbda85.tar.bz2
newspipe-bd388e6db9a4f914f623f0d27a981ab494cbda85.zip
Display all shared bookmarks for a guest.
Diffstat (limited to 'src')
-rw-r--r--src/web/views/bookmark.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/web/views/bookmark.py b/src/web/views/bookmark.py
index 93da0023..04e79c09 100644
--- a/src/web/views/bookmark.py
+++ b/src/web/views/bookmark.py
@@ -49,15 +49,19 @@ bookmark_bp = Blueprint('bookmark', __name__, url_prefix='/bookmark')
@bookmarks_bp.route('/', defaults={'per_page': '50'}, methods=['GET'])
-@login_required
def list(per_page):
"Lists the bookmarks."
head_titles = [gettext("Bookmarks")]
- page, per_page, offset = get_page_args()
- bookmark_contr = BookmarkController(current_user.id)
- bookmarks = bookmark_contr.read().order_by(desc('time'))
+ if current_user.is_authenticated:
+ # query for the bookmarks of the authenticated user
+ bookmark_query = BookmarkController(current_user.id).read()
+ else:
+ # shared bookmarks of all users
+ bookmark_query = BookmarkController().read(**{'shared': True})
+ bookmarks = bookmark_query.order_by(desc('time'))
+ page, per_page, offset = get_page_args()
pagination = Pagination(page=page, total=bookmarks.count(),
css_framework='bootstrap3',
search=False, record_name='bookmarks',
bgstack15