diff --git a/keyserver/src/fetchers/user-fetchers.js b/keyserver/src/fetchers/user-fetchers.js --- a/keyserver/src/fetchers/user-fetchers.js +++ b/keyserver/src/fetchers/user-fetchers.js @@ -265,6 +265,20 @@ return row.username; } +async function fetchKeyserverAdminID(): Promise { + const query = SQL` + SELECT m.user FROM memberships m + INNER JOIN roles r ON m.role = r.id + INNER JOIN threads t ON r.thread = t.id + WHERE r.name = "Admins" AND t.community IS NULL + `; + const [result] = await dbQuery(query); + if (result.length === 0) { + return null; + } + return result[0].user; +} + export { fetchUserInfos, fetchLoggedInUserInfo, @@ -274,4 +288,5 @@ fetchAllUserIDs, fetchUsername, fetchKnownUserInfos, + fetchKeyserverAdminID, };