diff --git a/lib/permissions/special-roles.js b/lib/permissions/special-roles.js --- a/lib/permissions/special-roles.js +++ b/lib/permissions/special-roles.js @@ -28,19 +28,23 @@ }); function patchRoleInfoWithSpecialRole(role: RoleInfo): RoleInfo { + // We removed the `.isDefault` field from `RoleInfo`, but persisted + // `RoleInfo`s will still have the field until this migration. + // $FlowIgnore[prop-missing] + const { isDefault, ...roleSansIsDefault } = role; if (roleIsDefaultRole(role)) { return { - ...role, + ...roleSansIsDefault, specialRole: specialRoles.DEFAULT_ROLE, }; } else if (roleIsAdminRole(role)) { return { - ...role, + ...roleSansIsDefault, specialRole: specialRoles.ADMIN_ROLE, }; } else { return { - ...role, + ...roleSansIsDefault, specialRole: null, }; }