diff --git a/keyserver/src/fetchers/thread-fetchers.js b/keyserver/src/fetchers/thread-fetchers.js --- a/keyserver/src/fetchers/thread-fetchers.js +++ b/keyserver/src/fetchers/thread-fetchers.js @@ -18,6 +18,7 @@ type ServerThreadInfo, type MixedRawThreadInfos, type LegacyRawThreadInfo, + ServerLegacyRoleInfo, } from 'lib/types/thread-types.js'; import { ServerError } from 'lib/utils/errors.js'; @@ -100,7 +101,7 @@ const whereClause = filter ? constructWhereClause(filter) : ''; const rolesQuery = SQL` - SELECT t.id, r.id AS role, r.name, r.permissions, + SELECT t.id, r.id AS role, r.name, r.permissions, r.special_role r.special_role = ${specialRoles.DEFAULT_ROLE} AS is_default ` .append(primaryFetchClause) @@ -233,12 +234,14 @@ } const role = rolesRow.role.toString(); if (!threadInfos[threadID].roles[role]) { - threadInfos[threadID].roles[role] = { + const roleInfo: ServerLegacyRoleInfo = { id: role, name: rolesRow.name, permissions: JSON.parse(rolesRow.permissions), isDefault: Boolean(rolesRow.is_default), + specialRole: rolesRow.special_role, }; + threadInfos[threadID].roles[role] = roleInfo; } } diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js --- a/lib/types/thread-types.js +++ b/lib/types/thread-types.js @@ -157,7 +157,7 @@ +community: ?string, +depth: number, +members: $ReadOnlyArray, - +roles: { +[id: string]: ClientLegacyRoleInfo }, + +roles: { +[id: string]: ServerLegacyRoleInfo }, +sourceMessageID?: string, +repliesCount: number, +pinnedCount: number,