Prevent running into the error `'conflicts:' operator is not supported`

The config value `conflicts_predicate_enabled` was introduced in
change 306509. Since then the change page logs an error every time that
a change page is loaded. We can easily check whether the config value
is set, so only make the call when we know that it is supported.

Google-Bug-Id: b/201122253
Change-Id: I1ae19c2655de504f398b8a836c4299adad14ed38
diff --git a/polygerrit-ui/app/api/rest-api.ts b/polygerrit-ui/app/api/rest-api.ts
index 95bcb22..314ea8b 100644
--- a/polygerrit-ui/app/api/rest-api.ts
+++ b/polygerrit-ui/app/api/rest-api.ts
@@ -362,6 +362,7 @@
   submit_whole_topic?: boolean;
   disable_private_changes?: boolean;
   mergeability_computation_behavior: MergeabilityComputationBehavior;
+  conflicts_predicate_enabled?: boolean;
 }
 
 export type ChangeId = BrandType<string, '_changeId'>;
diff --git a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts
index 41d9b24..54c8b89 100644
--- a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts
+++ b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts
@@ -47,10 +47,6 @@
 const SIGN_IN_WIDTH_PX = 690;
 const SIGN_IN_HEIGHT_PX = 500;
 const TOO_MANY_FILES = 'too many files to find conflicts';
-/* TODO: This error is suppressed to allow rolling upgrades.
- * Remove on stable-3.6 */
-const CONFLICTS_OPERATOR_IS_NOT_SUPPORTED =
-  "'conflicts:' operator is not supported by server";
 const AUTHENTICATION_REQUIRED = 'Authentication required\n';
 
 // Bigger number has higher priority
@@ -202,10 +198,7 @@
   }
 
   _shouldSuppressError(msg: string) {
-    return (
-      msg.includes(TOO_MANY_FILES) ||
-      msg.includes(CONFLICTS_OPERATOR_IS_NOT_SUPPORTED)
-    );
+    return msg.includes(TOO_MANY_FILES);
   }
 
   private readonly handleAuthRequired = () => {
diff --git a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.ts b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.ts
index 09c6a4e..d81be15 100644
--- a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager_test.ts
@@ -243,24 +243,6 @@
       assert.isFalse(showAlertStub.called);
     });
 
-    test('suppress CONFLICTS_OPERATOR_IS_NOT_SUPPORTED error', async () => {
-      const showAlertStub = sinon.stub(element, '_showAlert');
-      const textSpy = sinon.spy(() =>
-        Promise.resolve("'conflicts:' operator is not supported by server")
-      );
-      element.dispatchEvent(
-        new CustomEvent('server-error', {
-          detail: {response: {status: 500, text: textSpy}},
-          composed: true,
-          bubbles: true,
-        })
-      );
-
-      assert.isTrue(textSpy.called);
-      await flush();
-      assert.isFalse(showAlertStub.called);
-    });
-
     test('show network error', async () => {
       const showAlertStub = sinon.stub(element, '_showAlert');
       element.dispatchEvent(
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-impl.ts b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-impl.ts
index ae6268d..6d0839f 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-impl.ts
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-impl.ts
@@ -1722,9 +1722,13 @@
     }) as Promise<SubmittedTogetherInfo | undefined>;
   }
 
-  getChangeConflicts(
+  async getChangeConflicts(
     changeNum: NumericChangeId
   ): Promise<ChangeInfo[] | undefined> {
+    const config = await this.getConfig(false);
+    if (!config?.change?.conflicts_predicate_enabled) {
+      return [];
+    }
     const options = listChangesOptionsToHex(
       ListChangesOption.CURRENT_REVISION,
       ListChangesOption.CURRENT_COMMIT