From 2fbc44bd54a3f0ed67cbb6236e38afbb407a2135 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Mon, 10 Jun 2019 00:11:57 +0100 Subject: [PATCH] Make user list public --- app/templates/base.html | 3 ++- app/templates/users/list.html | 6 ++++-- app/views/users/users.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/templates/base.html b/app/templates/base.html index e672890b..2f483dc2 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -133,7 +133,8 @@ GitHub | Help | Policy and Guidance | - Report / DMCA + Report / DMCA | + User List diff --git a/app/templates/users/list.html b/app/templates/users/list.html index 6bc23b5e..5ec56626 100644 --- a/app/templates/users/list.html +++ b/app/templates/users/list.html @@ -11,8 +11,10 @@ {{ user.display_name }} - - {{ user.rank.getTitle() }} - - {{ user.packages.count() }} packages. + {{ user.rank.getTitle() }} + {% if current_user.is_authenticated %} + - {{ user.packages.count() }} packages. + {% endif %} {% endfor %} {% endblock %} diff --git a/app/views/users/users.py b/app/views/users/users.py index 6317d6bd..02def255 100644 --- a/app/views/users/users.py +++ b/app/views/users/users.py @@ -35,8 +35,8 @@ class UserProfileForm(FlaskForm): rank = SelectField("Rank", [Optional()], choices=UserRank.choices(), coerce=UserRank.coerce, default=UserRank.NEW_MEMBER) submit = SubmitField("Save") + @app.route("/users/", methods=["GET"]) -@login_required def user_list_page(): users = User.query.order_by(db.desc(User.rank), db.asc(User.display_name)).all() return render_template("users/list.html", users=users)