From be24e02fe9eaaeae877ff9e7495b0fb00f6c8db8 Mon Sep 17 00:00:00 2001 From: laurent doreille <laurent.doreille@protonmail.com> Date: Sun, 24 May 2020 15:12:54 +0200 Subject: [PATCH] issue#43 --- hiboo/models.py | 4 +++- hiboo/profile/admin.py | 2 +- hiboo/profile/templates/profile_list.html | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hiboo/models.py b/hiboo/models.py index fd1205d..1a07dc5 100644 --- a/hiboo/models.py +++ b/hiboo/models.py @@ -176,13 +176,15 @@ class Profile(db.Model): ACTIVE = "active" BLOCKED = "blocked" DELETED = "deleted" + REJECTED = "rejected" STATUSES = { UNCLAIMED: ("gray", _("unclaimed")), REQUEST: ("blue", _("requested")), ACTIVE: ("green", _("active")), BLOCKED: ("orange", _("blocked")), - DELETED: ("red", _("deleted")) + DELETED: ("red", _("deleted")), + REJECTED: ("orange", _("rejected")) } user_uuid = db.Column(db.String(36), db.ForeignKey(User.uuid)) diff --git a/hiboo/profile/admin.py b/hiboo/profile/admin.py index 1a99cb0..a5c4762 100644 --- a/hiboo/profile/admin.py +++ b/hiboo/profile/admin.py @@ -34,7 +34,7 @@ def details(profile_uuid): @security.confirmation_required("change the profile status") @security.admin_required() def set_status(profile_uuid, status): - if status not in (models.Profile.ACTIVE, models.Profile.BLOCKED): + if status not in (models.Profile.ACTIVE, models.Profile.BLOCKED, models.Profile.REJECTED): flask.abort(403) profile = models.Profile.query.get(profile_uuid) or flask.abort(404) profile.status = status diff --git a/hiboo/profile/templates/profile_list.html b/hiboo/profile/templates/profile_list.html index 08b1e6f..d8d8fa7 100644 --- a/hiboo/profile/templates/profile_list.html +++ b/hiboo/profile/templates/profile_list.html @@ -49,6 +49,7 @@ <a href="{{ url_for("profile.set_status", profile_uuid=profile.uuid, status="active") }}">{% trans %}Unblock profile{% endtrans %}</a> {% elif profile.status == "request" %} <a href="{{ url_for("profile.set_status", profile_uuid=profile.uuid, status="active") }}">{% trans %}Validate profile{% endtrans %}</a> + <a href="{{ url_for("profile.set_status", profile_uuid=profile.uuid, status="rejected") }}">{% trans %}Rejected profile{% endtrans %}</a> {% elif profile.status == "unclaimed" %} <a href="{{ url_for("profile.assign", profile_uuid=profile.uuid) }}">{% trans %}Assign profile{% endtrans %}</a> {% endif %} -- GitLab