add user bookmarks view
This commit is contained in:
@@ -4,7 +4,7 @@ from flask import (
|
||||
from functools import wraps
|
||||
from ..db import db
|
||||
from ..lib.babycode import babycode_to_html, BABYCODE_VERSION
|
||||
from ..models import Users, Sessions, Subscriptions, Avatars, PasswordResetLinks, InviteKeys
|
||||
from ..models import Users, Sessions, Subscriptions, Avatars, PasswordResetLinks, InviteKeys, BookmarkCollections
|
||||
from ..constants import InfoboxKind, PermissionLevel
|
||||
from ..auth import digest, verify
|
||||
from wand.image import Image
|
||||
@@ -260,6 +260,8 @@ def sign_up_post():
|
||||
"permission": PermissionLevel.GUEST.value,
|
||||
})
|
||||
|
||||
BookmarkCollections.create_default(new_user.id)
|
||||
|
||||
if current_app.config['DISABLE_SIGNUP']:
|
||||
invite_key = InviteKeys.find({'key': key})
|
||||
new_user.update({
|
||||
@@ -688,3 +690,14 @@ def revoke_invite_link(username):
|
||||
invite.delete()
|
||||
|
||||
return redirect(url_for('.invite_links', username=target_user.username))
|
||||
|
||||
|
||||
@bp.get('/<username>/bookmarks')
|
||||
@login_required
|
||||
def bookmarks(username):
|
||||
target_user = Users.find({'username': username})
|
||||
if not target_user or target_user.username != get_active_user().username:
|
||||
return redirect(url_for('.bookmarks', username=get_active_user().username))
|
||||
|
||||
collections = target_user.get_bookmark_collections()
|
||||
return render_template('users/bookmarks.html', collections=collections)
|
||||
|
||||
Reference in New Issue
Block a user