feature/balance #13
|
@ -231,3 +231,21 @@ def notifications(current_session):
|
||||||
def remove_notifications(nid, current_session):
|
def remove_notifications(nid, current_session):
|
||||||
userController.delete_notification(nid, current_session.user_)
|
userController.delete_notification(nid, current_session.user_)
|
||||||
return no_content()
|
return no_content()
|
||||||
|
|
||||||
|
|
||||||
|
@UsersPlugin.blueprint.route("/users/<userid>/shortcuts", methods=["GET", "PUT"])
|
||||||
|
@login_required()
|
||||||
|
def shortcuts(userid, current_session):
|
||||||
|
if userid != current_session.user_.userid:
|
||||||
|
raise Forbidden
|
||||||
|
|
||||||
|
user = userController.get_user(userid)
|
||||||
|
if request.method == "GET":
|
||||||
|
return jsonify(user.get_attribute("users_link_shortcuts", []))
|
||||||
|
else:
|
||||||
|
data = request.get_json()
|
||||||
|
if not isinstance(data, list) or not all(isinstance(n, dict) for n in data):
|
||||||
|
raise BadRequest
|
||||||
|
user.set_attribute("users_link_shortcuts", data)
|
||||||
|
userController.persist()
|
||||||
|
return no_content()
|
||||||
|
|
Loading…
Reference in New Issue