mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-04 11:44:47 +08:00
fix(sync): Do not paginate /metadata unless pluginsSupported
This commit is contained in:
parent
a69d918c0f
commit
c296e2e1d4
2 changed files with 14 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue