From 3af91d22b6d0096c2dbd06c501ccaa2ea1204f18 Mon Sep 17 00:00:00 2001 From: Drew Regitsky Date: Fri, 18 Mar 2016 10:41:08 -0700 Subject: [PATCH] fix(sync-state): ignore Account.syncState=="stopped" for now Valid accounts that are syncing properly can reviece a delta for Account.syncState==stopped currently, due to some quirks in the backend. Ignore "stopped" until it unabiguously represents an error state. --- .../account-error-header/lib/account-error-header.jsx | 2 +- .../preferences/lib/tabs/preferences-account-details.jsx | 2 +- .../preferences/lib/tabs/preferences-account-list.jsx | 2 +- src/flux/models/account.coffee | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/internal_packages/account-error-header/lib/account-error-header.jsx b/internal_packages/account-error-header/lib/account-error-header.jsx index f731a7b26..c6ec5d39f 100644 --- a/internal_packages/account-error-header/lib/account-error-header.jsx +++ b/internal_packages/account-error-header/lib/account-error-header.jsx @@ -55,7 +55,7 @@ export default class AccountErrorHeader extends React.Component { } render() { - const errorAccounts = this.state.accounts.filter(a => a.syncState !== "running"); + const errorAccounts = this.state.accounts.filter(a => a.hasSyncStateError()); if (errorAccounts.length === 1) { const account = errorAccounts[0]; diff --git a/internal_packages/preferences/lib/tabs/preferences-account-details.jsx b/internal_packages/preferences/lib/tabs/preferences-account-details.jsx index ea48bfbb6..157d0aaea 100644 --- a/internal_packages/preferences/lib/tabs/preferences-account-details.jsx +++ b/internal_packages/preferences/lib/tabs/preferences-account-details.jsx @@ -142,7 +142,7 @@ class PreferencesAccountDetails extends Component { } _renderSyncErrorDetails() { const {account} = this.state; - if (account.syncState !== Account.SYNC_STATE_RUNNING) { + if (account.hasSyncStateError()) { switch (account.syncState) { case Account.SYNC_STATE_AUTH_FAILED: return this._renderErrorDetail( diff --git a/internal_packages/preferences/lib/tabs/preferences-account-list.jsx b/internal_packages/preferences/lib/tabs/preferences-account-list.jsx index aea022902..84a4faec8 100644 --- a/internal_packages/preferences/lib/tabs/preferences-account-list.jsx +++ b/internal_packages/preferences/lib/tabs/preferences-account-list.jsx @@ -26,7 +26,7 @@ class PreferencesAccountList extends Component { _renderAccount = (account)=> { const label = account.label; const accountSub = `${account.name || 'No name provided'} <${account.emailAddress}>`; - const syncError = account.syncState !== Account.SYNC_STATE_RUNNING; + const syncError = account.hasSyncStateError(); return (
+ # TODO: ignoring "stopped" until it's no longer overloaded on API + return @syncState != Account.SYNC_STATE_RUNNING && + @syncState != Account.SYNC_STATE_STOPPED module.exports = Account