diff --git a/keyserver/src/fetchers/role-fetchers.js b/keyserver/src/fetchers/role-fetchers.js --- a/keyserver/src/fetchers/role-fetchers.js +++ b/keyserver/src/fetchers/role-fetchers.js @@ -1,15 +1,16 @@ // @flow +import { specialRoles } from 'lib/permissions/special-roles.js'; import type { RoleInfo } from 'lib/types/thread-types.js'; import { dbQuery, SQL } from '../database/database.js'; async function fetchRoles(threadID: string): Promise { const query = SQL` - SELECT r.id, r.name, r.permissions, r.id = t.default_role AS is_default - FROM roles r - LEFT JOIN threads t ON t.id = r.thread - WHERE r.thread = ${threadID} + SELECT id, name, permissions, + special_role = ${specialRoles.DEFAULT_ROLE} AS is_default + FROM roles + WHERE thread = ${threadID} `; const [result] = await dbQuery(query);