From 2d0fdc2f64d1d99390e12c114274cbc79d8ff9bd Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 20 Dec 2020 11:31:29 +0000 Subject: [PATCH] Accounts in alphabetical order --- webapp_moderation.py | 50 +++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/webapp_moderation.py b/webapp_moderation.py index 2ba253ff9..45401d380 100644 --- a/webapp_moderation.py +++ b/webapp_moderation.py @@ -163,35 +163,41 @@ def htmlModerationInfo(cssCache: {}, translate: {}, infoForm += ' \n' infoForm += ' \n' infoForm += '\n' - col = 0 + accounts = [] for subdir, dirs, files in os.walk(baseDir + '/accounts'): for acct in dirs: if '@' not in acct: continue if 'inbox@' in acct or 'news@' in acct: continue - accountDir = os.path.join(baseDir + '/accounts', acct) - acctNickname = acct.split('@')[0] - actorJson = loadJson(accountDir + '.json') - if not actorJson: - continue - actor = actorJson['id'] - avatarUrl = '' - if actorJson.get('icon'): - if actorJson['icon'].get('url'): - avatarUrl = actorJson['icon']['url'] - acctUrl = \ - '/users/' + nickname + '?options=' + actor + ';1;' + \ - '/avatars/' + avatarUrl.replace('/', '-') - infoForm += '\n' - infoForm += '' - infoForm += '
' + acctNickname - infoForm += '
\n\n' - col += 1 - if col == cols: - # new row of accounts - infoForm += '\n\n' + accounts.append(acct) break + accounts.sort() + + col = 0 + for acct in accounts: + acctNickname = acct.split('@')[0] + accountDir = os.path.join(baseDir + '/accounts', acct) + actorJson = loadJson(accountDir + '.json') + if not actorJson: + continue + actor = actorJson['id'] + avatarUrl = '' + if actorJson.get('icon'): + if actorJson['icon'].get('url'): + avatarUrl = actorJson['icon']['url'] + acctUrl = \ + '/users/' + nickname + '?options=' + actor + ';1;' + \ + '/avatars/' + avatarUrl.replace('/', '-') + infoForm += '\n' + infoForm += '' + infoForm += '
' + acctNickname + infoForm += '
\n\n' + col += 1 + if col == cols: + # new row of accounts + infoForm += '\n\n' infoForm += '\n\n' infoForm += '\n'