fix: ensure we return the correct server's owner

This commit is contained in:
Alexis Tyler
2021-04-14 22:11:57 +09:30
parent 6e993d5cf2
commit 24b66f871e

View File

@@ -3,6 +3,7 @@
* Written by: Alexis Tyler
*/
import { varState } from '../../../core/states';
import { ensurePermission } from '../../../core/utils';
import { Context, getServers } from '../../schema/utils';
@@ -16,6 +17,6 @@ export default async (_: unknown, __: unknown, context: Context) => {
// Get all servers
const servers = await getServers();
// Return the owner of the first
return servers[0].owner;
// Return the owner of this server
return servers.find(server => server.guid === varState.data.regGuid)?.owner;
};