diff --git a/internal_packages/worker-sync/lib/nylas-sync-worker.coffee b/internal_packages/worker-sync/lib/nylas-sync-worker.coffee index 691a23c33..d9d01075b 100644 --- a/internal_packages/worker-sync/lib/nylas-sync-worker.coffee +++ b/internal_packages/worker-sync/lib/nylas-sync-worker.coffee @@ -139,7 +139,10 @@ class NylasSyncWorker console.log("Retrieved #{offset + data.length} metadata objects") finished() - makeMetadataRequest(0) + if @_api.pluginsSupported + makeMetadataRequest(0) + else + finished() shouldFetchCollection: (model) -> return false unless @_state diff --git a/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee b/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee index 95e5efbef..2fd60267a 100644 --- a/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee +++ b/internal_packages/worker-sync/spec/nylas-sync-worker-spec.coffee @@ -7,6 +7,7 @@ describe "NylasSyncWorker", -> beforeEach -> @apiRequests = [] @api = + pluginsSupported: true accessTokenForAccountId: => '123' makeRequest: (requestOptions) => @@ -192,6 +193,15 @@ describe "NylasSyncWorker", -> fetchAllMetadataCallback() expect(@worker.fetchCollection.calls.length).not.toBe(0) + it "should not fetch metadata pages if pluginsSupported is false", -> + @api.pluginsSupported = false + spyOn(NylasSyncWorker.prototype, '_fetchWithErrorHandling') + spyOn(@worker, 'fetchCollection') + @worker._state = {} + @worker.resumeFetches() + expect(@worker._fetchWithErrorHandling).not.toHaveBeenCalled() + expect(@worker.fetchCollection.calls.length).not.toBe(0) + it "should fetch collections for which `shouldFetchCollection` returns true", -> spyOn(@worker, 'fetchCollection') spyOn(@worker, 'shouldFetchCollection').andCallFake (collection) =>