From 2cfb3ccd50ffbe2b485848016d86d5fb6afa9eb1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 1 Jan 2023 10:49:40 +0000 Subject: [PATCH] Sort dropdown list by domain --- webapp_utils.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/webapp_utils.py b/webapp_utils.py index 7828bfed6..d4c9e625a 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -2054,14 +2054,22 @@ def html_following_dropdown(base_dir: str, nickname: str, # no petnames list exists - just use following.txt following_list = msg.split('\n') list_str += '\n' - following_list.sort() if following_list: + domain_sorted_list = [] for following_address in following_list: - if not following_address: - continue if '@' not in following_address and \ '://' not in following_address: continue + foll_nick = get_nickname_from_actor(following_address) + foll_domain, _ = get_domain_from_actor(following_address) + if not foll_domain or not foll_nick: + continue + domain_sorted_list.append(foll_domain + ' ' + + foll_nick + '@' + foll_domain) + domain_sorted_list.sort() + + for following_line in domain_sorted_list: + following_address = following_line.split(' ')[1] list_str += '\n' list_str += '\n'