From 82339c8c1f15b07b5e261d7b21355e496a18dcc4 Mon Sep 17 00:00:00 2001 From: Li Chaoran Date: Sat, 29 Jul 2023 18:00:44 +0800 Subject: [PATCH] group alias need 1:1 mapping to group Signed-off-by: Li Chaoran --- frontend/coprs_frontend/coprs/models.py | 3 +-- .../coprs/templates/_helpers.html | 7 +------ .../coprs/templates/coprs/show/group.html | 2 +- .../templates/groups/user_fas_groups.html | 4 ++-- .../coprs/views/groups_ns/groups_general.py | 19 ++++++++++++------- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/frontend/coprs_frontend/coprs/models.py b/frontend/coprs_frontend/coprs/models.py index 038534b47..f33cbede6 100644 --- a/frontend/coprs_frontend/coprs/models.py +++ b/frontend/coprs_frontend/coprs/models.py @@ -2206,8 +2206,7 @@ class Group(db.Model, helpers.Serializer): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(127)) - # TODO: add unique=True - fas_name = db.Column(db.String(127)) + fas_name = db.Column(db.String(127), unique=True) @property def at_name(self): diff --git a/frontend/coprs_frontend/coprs/templates/_helpers.html b/frontend/coprs_frontend/coprs/templates/_helpers.html index 317d82e74..3956dd6f2 100644 --- a/frontend/coprs_frontend/coprs/templates/_helpers.html +++ b/frontend/coprs_frontend/coprs/templates/_helpers.html @@ -304,7 +304,7 @@

{{ g.user.name | capitalize}}

{{ g.user.coprs_count }} My projects - {% if config.FAS_LOGIN or config.LDAP_URL %} + {% if config.FAS_LOGIN or config.LDAP_URL or config.OIDC_LOGIN %} {{ user.user_groups|length }} My groups @@ -458,11 +458,6 @@

News - Read All

{{- copr_url('coprs_ns.copr_package', package.copr, package_name=package.name) -}} {% endmacro %} -{%- macro fas_group_href(name) -%} -https://accounts.fedoraproject.org/group/{{name}} -{%- endmacro -%} - - {% macro repo_file_href(copr, repo, arch=None) %} {%- if not arch %} {{- owner_url('coprs_ns.generate_repo_file', diff --git a/frontend/coprs_frontend/coprs/templates/coprs/show/group.html b/frontend/coprs_frontend/coprs/templates/coprs/show/group.html index e7185d45c..6679298ab 100644 --- a/frontend/coprs_frontend/coprs/templates/coprs/show/group.html +++ b/frontend/coprs_frontend/coprs/templates/coprs/show/group.html @@ -1,7 +1,7 @@ {% extends "coprs/group_show.html" %} {% block title %}Project List{% endblock %} {% block header %}Project List{% endblock %} -{% from "_helpers.html" import render_pagination, fas_group_href %} +{% from "_helpers.html" import render_pagination %} {% block breadcrumbs %}