diff --git a/server/postgres/src/storage.ts b/server/postgres/src/storage.ts index 7c88642032..ccce30a4f6 100644 --- a/server/postgres/src/storage.ts +++ b/server/postgres/src/storage.ts @@ -1137,7 +1137,16 @@ abstract class PostgresAdapterBase implements DbAdapter { case '$in': switch (type) { case 'common': - res.push(`${tkey} IN (${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'})`) + if (Array.isArray(val) && val.includes(null)) { + res.push( + `(${tkey} IN (${val + .filter((it) => it != null) + .map((v: any) => `'${v}'`) + .join(', ')}) OR ${tkey} IS NULL)` + ) + } else { + res.push(`${tkey} IN (${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'})`) + } break case 'array': res.push(`${tkey} && array[${val.length > 0 ? val.map((v: any) => `'${v}'`).join(', ') : 'NULL'}]`) @@ -1148,7 +1157,14 @@ abstract class PostgresAdapterBase implements DbAdapter { } break case '$nin': - if (val.length > 0) { + if (Array.isArray(val) && val.includes(null)) { + res.push( + `(${tkey} NOT IN (${val + .filter((it) => it != null) + .map((v: any) => `'${v}'`) + .join(', ')}) AND ${tkey} IS NOT NULL)` + ) + } else if (val.length > 0) { res.push(`${tkey} NOT IN (${val.map((v: any) => `'${v}'`).join(', ')})`) } break diff --git a/services/github/pod-github/src/sync/configuration.ts b/services/github/pod-github/src/sync/configuration.ts new file mode 100644 index 0000000000..5eb37732e9 --- /dev/null +++ b/services/github/pod-github/src/sync/configuration.ts @@ -0,0 +1,6 @@ +/** + * @public + */ +export const githubConfiguration = { + ResolveThreadSupported: false +} diff --git a/services/github/pod-github/src/sync/reviewThreads.ts b/services/github/pod-github/src/sync/reviewThreads.ts index 965785b64e..05db4229f6 100644 --- a/services/github/pod-github/src/sync/reviewThreads.ts +++ b/services/github/pod-github/src/sync/reviewThreads.ts @@ -41,6 +41,7 @@ import { Analytics } from '@hcengineering/analytics' import { PullRequestReviewThreadEvent } from '@octokit/webhooks-types' import config from '../config' import { syncConfig } from './syncConfig' +import { githubConfiguration } from './configuration' export type ReviewThreadData = Pick< GithubReviewThread, @@ -362,7 +363,7 @@ export class ReviewThreadSyncManager implements DocSyncManager { if (Object.keys(platformUpdate).length > 0) { // Check and update external - if (platformUpdate.isResolved !== undefined) { + if (platformUpdate.isResolved !== undefined && githubConfiguration.ResolveThreadSupported) { const okit = (await this.provider.getOctokit(account as Ref)) ?? container.container.octokit const q = `mutation updateReviewThread($threadID: ID!) { ${platformUpdate.isResolved ? 'resolveReviewThread' : 'unresolveReviewThread'} (