refactor: use user_servers junction table instead of JSON column

This commit is contained in:
2026-07-15 04:55:57 +08:00
parent a34314ac9d
commit a8309aa456
3 changed files with 28 additions and 4 deletions

View File

@@ -60,7 +60,7 @@ const UsersPage = {
async loadUserServers(id, username, email, gameName, gameUid, role, active, source) {
let groups = [], userServers = [];
try { groups = await API.get('/polls/groups'); } catch {}
try { const u = await API.get('/users/'+id); userServers = u.admin_servers ? (typeof u.admin_servers==='string'?JSON.parse(u.admin_servers):u.admin_servers) : []; } catch {}
try { userServers = await API.get('/users/'+id+'/servers'); } catch {}
const checks = groups.map(g => {
const key = g.group_name+'::'+g.server_name;
const has = userServers.some(s => s.group_name===g.group_name && s.server_name===g.server_name);