add list of workspaces to all workspace routes
This commit is contained in:
parent
676daa5e32
commit
80849a3207
@ -30,12 +30,14 @@ bp = Blueprint("workspaces", __name__)
|
|||||||
|
|
||||||
@bp.context_processor
|
@bp.context_processor
|
||||||
def workspace():
|
def workspace():
|
||||||
|
workspaces = Workspaces.for_user(g.current_user)
|
||||||
workspace = None
|
workspace = None
|
||||||
if "workspace_id" in http_request.view_args:
|
if "workspace_id" in http_request.view_args:
|
||||||
try:
|
try:
|
||||||
workspace = Workspaces.get(
|
workspace = Workspaces.get(
|
||||||
g.current_user, http_request.view_args["workspace_id"]
|
g.current_user, http_request.view_args["workspace_id"]
|
||||||
)
|
)
|
||||||
|
workspaces = [ws for ws in workspaces if not ws.id == workspace.id]
|
||||||
except UnauthorizedError:
|
except UnauthorizedError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ def workspace():
|
|||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return {"workspace": workspace, "permissions": Permissions, "user_can": user_can}
|
return {"workspace": workspace, "workspaces": workspaces, "permissions": Permissions, "user_can": user_can}
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/workspaces")
|
@bp.route("/workspaces")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user