Do not show profiles of suspended accounts

This should likely be extended to other services as well, but the hub is
certainly a good point to start.
This commit is contained in:
Conrad Hoffmann 2024-01-24 16:12:09 +01:00
parent 32bedb1524
commit 9670ee1409
1 changed files with 4 additions and 2 deletions

View File

@ -4,14 +4,16 @@ from flask import Blueprint, render_template, request, abort
from hubsrht.types import User, Project, Visibility, Event, EventType
from hubsrht.types import SourceRepo, MailingList, Tracker
from srht.flask import paginate_query
from srht.oauth import current_user
from srht.oauth import current_user, UserType
from srht.search import search_by
users = Blueprint("users", __name__)
@users.route("/~<username>/")
def summary_GET(username):
user = User.query.filter(User.username == username).first()
user = (User.query
.filter(User.username == username)
.filter(User.user_type != UserType.suspended)).first()
if not user:
abort(404)
projects = (Project.query