fix(sync-status): Actually fix sync status logic

- Must take into account that some accounts have `labels` and others
have `folders`
This commit is contained in:
Juan Tejada 2016-04-05 14:03:11 -07:00
parent cef7809bd6
commit 7d2bf7bed5

View file

@ -39,11 +39,13 @@ class NylasSyncStatusStore extends NylasStore
isSyncCompleteForAccount: (acctId, model) => isSyncCompleteForAccount: (acctId, model) =>
return false unless @_statesByAccount[acctId] return false unless @_statesByAccount[acctId]
return false if _.isEmpty(@_statesByAccount[acctId])
if model if model
return @_statesByAccount[acctId][model]?.complete ? false return @_statesByAccount[acctId][model]?.complete ? false
for _model in ModelsForSync
modelState = @_statesByAccount[_model] for _model, modelState of @_statesByAccount
return false if not modelState?.complete continue unless _model in ModelsForSync
return false if not modelState.complete
return true return true
isSyncComplete: => isSyncComplete: =>