feat: make people group labels editable
This commit is contained in:
+3
-3
@@ -2,7 +2,7 @@ from collections import OrderedDict
|
||||
|
||||
|
||||
ROLE_PRIORITY = {"lead": 0, "leader": 0, "organizer": 1, "collaborator": 2}
|
||||
ROLE_TITLES = {0: "Lead / Leader", 1: "Organizers", 2: "Collaborators"}
|
||||
ROLE_LABEL_FIELDS = {0: "lead_group_label", 1: "organizer_group_label", 2: "collaborator_group_label"}
|
||||
|
||||
|
||||
def person_sort_key(person):
|
||||
@@ -10,7 +10,7 @@ def person_sort_key(person):
|
||||
return (ROLE_PRIORITY.get(role, 3), role if role not in ROLE_PRIORITY else "", person.order, person.pk or 0)
|
||||
|
||||
|
||||
def group_people(people):
|
||||
def group_people(people, branding):
|
||||
groups = OrderedDict()
|
||||
for person in sorted(people, key=person_sort_key):
|
||||
role = (person.role or "").strip()
|
||||
@@ -18,7 +18,7 @@ def group_people(people):
|
||||
key = priority if priority < 3 else role.casefold()
|
||||
if key not in groups:
|
||||
groups[key] = {
|
||||
"title": ROLE_TITLES[priority] if priority < 3 else role or "Other contributors",
|
||||
"title": getattr(branding, ROLE_LABEL_FIELDS[priority], "") if priority < 3 else role,
|
||||
"people": [],
|
||||
}
|
||||
groups[key]["people"].append(person)
|
||||
|
||||
Reference in New Issue
Block a user