mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 00:06:06 +08:00
[client-app] 🎨 Rename NylasSyncStatusStore to FolderSyncProgressStore
Summary: see title Test Plan: manual Reviewers: evan, spang, halla Reviewed By: halla Differential Revision: https://phab.nylas.com/D4141
This commit is contained in:
parent
aaf4cb60b2
commit
7b9680fff4
|
@ -11,7 +11,7 @@ SyncbackActivity = require("./syncback-activity").default
|
|||
Actions,
|
||||
TaskQueue,
|
||||
AccountStore,
|
||||
NylasSyncStatusStore,
|
||||
FolderSyncProgressStore,
|
||||
TaskQueueStatusStore
|
||||
PerformSendActionTask,
|
||||
SendDraftTask} = require 'nylas-exports'
|
||||
|
@ -36,7 +36,7 @@ class ActivitySidebar extends React.Component
|
|||
componentDidMount: =>
|
||||
@_unlisteners = []
|
||||
@_unlisteners.push TaskQueueStatusStore.listen @_onDataChanged
|
||||
@_unlisteners.push NylasSyncStatusStore.listen @_onDataChanged
|
||||
@_unlisteners.push FolderSyncProgressStore.listen @_onDataChanged
|
||||
|
||||
componentWillUnmount: =>
|
||||
unlisten() for unlisten in @_unlisteners
|
||||
|
@ -82,6 +82,6 @@ class ActivitySidebar extends React.Component
|
|||
|
||||
_getStateFromStores: =>
|
||||
tasks: TaskQueueStatusStore.queue()
|
||||
isInitialSyncComplete: NylasSyncStatusStore.isSyncComplete()
|
||||
isInitialSyncComplete: FolderSyncProgressStore.isSyncComplete()
|
||||
|
||||
module.exports = ActivitySidebar
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import _ from 'underscore';
|
||||
import _str from 'underscore.string';
|
||||
import {Utils, AccountStore, NylasSyncStatusStore, React} from 'nylas-exports';
|
||||
import {Utils, AccountStore, FolderSyncProgressStore, React} from 'nylas-exports';
|
||||
|
||||
const MONTH_SHORT_FORMATS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
|
||||
'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
|
@ -11,14 +11,14 @@ export default class InitialSyncActivity extends React.Component {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
syncState: NylasSyncStatusStore.getSyncState(),
|
||||
syncState: FolderSyncProgressStore.getSyncState(),
|
||||
}
|
||||
this.mounted = false;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.mounted = true;
|
||||
this.unsub = NylasSyncStatusStore.listen(this.onDataChanged)
|
||||
this.unsub = FolderSyncProgressStore.listen(this.onDataChanged)
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
|
@ -32,7 +32,7 @@ export default class InitialSyncActivity extends React.Component {
|
|||
}
|
||||
|
||||
onDataChanged = () => {
|
||||
const syncState = Utils.deepClone(NylasSyncStatusStore.getSyncState())
|
||||
const syncState = Utils.deepClone(FolderSyncProgressStore.getSyncState())
|
||||
this.setState({syncState});
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ export default class InitialSyncActivity extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
if (!AccountStore.accountsAreSyncing() || NylasSyncStatusStore.isSyncComplete()) {
|
||||
if (!AccountStore.accountsAreSyncing() || FolderSyncProgressStore.isSyncComplete()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {AccountStore, Actions, IdentityStore, NylasSyncStatusStore} from 'nylas-exports';
|
||||
import {AccountStore, Actions, IdentityStore, FolderSyncProgressStore} from 'nylas-exports';
|
||||
import {ipcRenderer} from 'electron';
|
||||
import NylasStore from 'nylas-store';
|
||||
|
||||
|
@ -174,7 +174,7 @@ class OnboardingStore extends NylasStore {
|
|||
provider: this._accountFromAuth.provider,
|
||||
});
|
||||
} else {
|
||||
await NylasSyncStatusStore.whenCategoryListSynced(json.id)
|
||||
await FolderSyncProgressStore.whenCategoryListSynced(json.id)
|
||||
this._onOnboardingComplete();
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
|
@ -22,7 +22,7 @@ classnames = require 'classnames'
|
|||
ExtensionRegistry,
|
||||
FocusedContentStore,
|
||||
FocusedPerspectiveStore
|
||||
NylasSyncStatusStore} = require 'nylas-exports'
|
||||
FolderSyncProgressStore} = require 'nylas-exports'
|
||||
|
||||
ThreadListColumns = require './thread-list-columns'
|
||||
ThreadListScrollTooltip = require './thread-list-scroll-tooltip'
|
||||
|
@ -46,7 +46,7 @@ class ThreadList extends React.Component
|
|||
|
||||
componentDidMount: =>
|
||||
@_reportAppBootTime()
|
||||
@unsub = NylasSyncStatusStore.listen(@_onSyncStatusChanged)
|
||||
@unsub = FolderSyncProgressStore.listen(@_onSyncStatusChanged)
|
||||
window.addEventListener('resize', @_onResize, true)
|
||||
ReactDOM.findDOMNode(@).addEventListener('contextmenu', @_onShowContextMenu)
|
||||
@_onResize()
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
DatabaseStore,
|
||||
SyncbackCategoryTask,
|
||||
TaskQueueStatusStore,
|
||||
NylasSyncStatusStore,
|
||||
FolderSyncProgressStore,
|
||||
} from 'nylas-exports';
|
||||
import {SNOOZE_CATEGORY_NAME} from './snooze-constants'
|
||||
|
||||
|
@ -59,7 +59,7 @@ const SnoozeUtils = {
|
|||
},
|
||||
|
||||
getSnoozeCategory(accountId, categoryName = SNOOZE_CATEGORY_NAME) {
|
||||
return NylasSyncStatusStore.whenCategoryListSynced(accountId)
|
||||
return FolderSyncProgressStore.whenCategoryListSynced(accountId)
|
||||
.then(() => {
|
||||
const allCategories = CategoryStore.categories(accountId)
|
||||
const category = _.findWhere(allCategories, {displayName: categoryName})
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
Category,
|
||||
Thread,
|
||||
CategoryStore,
|
||||
NylasSyncStatusStore,
|
||||
FolderSyncProgressStore,
|
||||
} from 'nylas-exports'
|
||||
import SnoozeUtils from '../lib/snooze-utils'
|
||||
|
||||
|
@ -15,7 +15,7 @@ xdescribe('Snooze Utils', function snoozeUtils() {
|
|||
beforeEach(() => {
|
||||
this.name = 'Snoozed Folder'
|
||||
this.accId = 123
|
||||
spyOn(NylasSyncStatusStore, 'whenCategoryListSynced').andReturn(Promise.resolve())
|
||||
spyOn(FolderSyncProgressStore, 'whenCategoryListSynced').andReturn(Promise.resolve())
|
||||
})
|
||||
|
||||
describe('snoozedUntilMessage', () => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {NylasSyncStatusStore} from 'nylas-exports'
|
||||
import {FolderSyncProgressStore} from 'nylas-exports'
|
||||
|
||||
const store = NylasSyncStatusStore
|
||||
const store = FolderSyncProgressStore
|
||||
|
||||
xdescribe('NylasSyncStatusStore', function nylasSyncStatusStore() {
|
||||
xdescribe('FolderSyncProgressStore', function nylasSyncStatusStore() {
|
||||
beforeEach(() => {
|
||||
store._statesByAccount = {}
|
||||
});
|
|
@ -4,7 +4,7 @@ ReactDOM = require 'react-dom'
|
|||
classNames = require 'classnames'
|
||||
RetinaImg = require('./retina-img').default
|
||||
EventedIFrame = require './evented-iframe'
|
||||
{NylasSyncStatusStore,
|
||||
{FolderSyncProgressStore,
|
||||
FocusedPerspectiveStore} = require 'nylas-exports'
|
||||
{SyncingListState} = require 'nylas-component-kit'
|
||||
|
||||
|
@ -91,7 +91,7 @@ class EmptyListState extends React.Component
|
|||
componentDidMount: ->
|
||||
@_mounted = true
|
||||
@_unlisteners = []
|
||||
@_unlisteners.push NylasSyncStatusStore.listen((=> @setState @_getStateFromStores()), @)
|
||||
@_unlisteners.push FolderSyncProgressStore.listen((=> @setState @_getStateFromStores()), @)
|
||||
@_unlisteners.push FocusedPerspectiveStore.listen((=> @setState @_getStateFromStores()), @)
|
||||
window.addEventListener('resize', @_onResize)
|
||||
if @props.visible and not @state.active
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* eslint global-require: 0 */
|
||||
import {NylasSyncStatusStore} from 'nylas-exports';
|
||||
import {FolderSyncProgressStore} from 'nylas-exports';
|
||||
import Model from './model';
|
||||
import Attributes from '../attributes';
|
||||
let AccountStore = null
|
||||
|
@ -181,9 +181,9 @@ export default class Category extends Model {
|
|||
// assigned an object type yet, just return based on the sync status for the
|
||||
// entire account.
|
||||
if (this.object !== 'folder') {
|
||||
return NylasSyncStatusStore.isSyncCompleteForAccount(this.accountId);
|
||||
return FolderSyncProgressStore.isSyncCompleteForAccount(this.accountId);
|
||||
}
|
||||
return NylasSyncStatusStore.isSyncCompleteForAccount(
|
||||
return FolderSyncProgressStore.isSyncCompleteForAccount(
|
||||
this.accountId,
|
||||
this.name || this.displayName
|
||||
);
|
||||
|
|
|
@ -43,17 +43,14 @@ class AccountStore extends NylasStore {
|
|||
|
||||
if (NylasEnv.isMainWindow() && newAccountIds.length > 0) {
|
||||
const newId = newAccountIds[0]
|
||||
// const NylasSyncStatusStore = require('./nylas-sync-status-store').default
|
||||
Actions.focusDefaultMailboxPerspectiveForAccounts([newId], {sidebarAccountIds: accountIds})
|
||||
const FolderSyncProgressStore = require('./folder-sync-progress-store').default
|
||||
await FolderSyncProgressStore.whenCategoryListSynced(newId)
|
||||
Actions.focusDefaultMailboxPerspectiveForAccounts([newId], {sidebarAccountIds: accountIds})
|
||||
// TODO:
|
||||
// Wait for a little bit before uncollapsong the sidebar to show the
|
||||
// newly focused inbox
|
||||
// This Action is a hack, get rid of it in sidebar refactor
|
||||
// Wait until the FocusedPerspectiveStore triggers and the sidebar is
|
||||
// updated to uncollapse the inbox for the new account
|
||||
const NylasSyncStatusStore = require('./nylas-sync-status-store').default
|
||||
await NylasSyncStatusStore.whenCategoryListSynced(newId)
|
||||
Actions.focusDefaultMailboxPerspectiveForAccounts([newId], {sidebarAccountIds: accountIds})
|
||||
Actions.setCollapsedSidebarItem('Inbox', false)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -5,7 +5,7 @@ import CategoryStore from './category-store'
|
|||
|
||||
|
||||
/**
|
||||
* NylasSyncStatusStore keeps track of the sync state per account, and will
|
||||
* FolderSyncProgressStore keeps track of the sync state per account, and will
|
||||
* trigger whenever it changes.
|
||||
*
|
||||
* The sync state for any given account has the following shape:
|
||||
|
@ -25,7 +25,7 @@ import CategoryStore from './category-store'
|
|||
* }
|
||||
*
|
||||
*/
|
||||
class NylasSyncStatusStore extends NylasStore {
|
||||
class FolderSyncProgressStore extends NylasStore {
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
|
@ -160,4 +160,4 @@ class NylasSyncStatusStore extends NylasStore {
|
|||
}
|
||||
}
|
||||
|
||||
export default new NylasSyncStatusStore()
|
||||
export default new FolderSyncProgressStore()
|
|
@ -165,7 +165,7 @@ lazyLoadAndRegisterStore(`FocusedContentStore`, 'focused-content-store');
|
|||
lazyLoadAndRegisterStore(`MessageBodyProcessor`, 'message-body-processor');
|
||||
lazyLoadAndRegisterStore(`FocusedContactsStore`, 'focused-contacts-store');
|
||||
lazyLoadAndRegisterStore(`TaskQueueStatusStore`, 'task-queue-status-store');
|
||||
lazyLoadAndRegisterStore(`NylasSyncStatusStore`, 'nylas-sync-status-store');
|
||||
lazyLoadAndRegisterStore(`FolderSyncProgressStore`, 'folder-sync-progress-store');
|
||||
lazyLoadAndRegisterStore(`ThreadListActionsStore`, 'thread-list-actions-store');
|
||||
lazyLoadAndRegisterStore(`FocusedPerspectiveStore`, 'focused-perspective-store');
|
||||
lazyLoadAndRegisterStore(`SearchableComponentStore`, 'searchable-component-store');
|
||||
|
|
Loading…
Reference in a new issue