mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 15:56:10 +08:00
fix(sync): Do not paginate /metadata unless pluginsSupported
This commit is contained in:
parent
963d1d92cb
commit
a24f67398e
|
@ -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
|
||||
|
|
|
@ -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) =>
|
||||
|
|
Loading…
Reference in a new issue