Remove current()? references, use Perspectiv.forNothing instead

This commit is contained in:
Ben Gotow 2016-01-18 01:31:35 -08:00
parent b7144d9402
commit 3ee96b714b
7 changed files with 10 additions and 13 deletions

View file

@ -13,7 +13,7 @@ class ThreadArchiveButton extends React.Component
thread: React.PropTypes.object.isRequired thread: React.PropTypes.object.isRequired
render: => render: =>
return false unless FocusedPerspectiveStore.current()?.canArchiveThreads() return false unless FocusedPerspectiveStore.current().canArchiveThreads()
<button className="btn btn-toolbar btn-archive" <button className="btn btn-toolbar btn-archive"
style={order: -107} style={order: -107}

View file

@ -28,7 +28,7 @@ class SearchSuggestionStore extends NylasStore
@listenTo SearchActions.searchBlurred, @_onSearchBlurred @listenTo SearchActions.searchBlurred, @_onSearchBlurred
_onPerspectiveChanged: => _onPerspectiveChanged: =>
@_searchQuery = FocusedPerspectiveStore.current()?.searchQuery ? "" @_searchQuery = FocusedPerspectiveStore.current().searchQuery ? ""
@trigger() @trigger()
_onQueryChanged: (query) => _onQueryChanged: (query) =>

View file

@ -25,7 +25,7 @@ class DraftListStore extends NylasStore
_queryForCurrentAccount: => _queryForCurrentAccount: =>
matchers = [Message.attributes.draft.equal(true)] matchers = [Message.attributes.draft.equal(true)]
account = FocusedPerspectiveStore.current()?.account account = FocusedPerspectiveStore.current().account
if account? if account?
matchers.push(Message.attributes.accountId.equal(account.id)) matchers.push(Message.attributes.accountId.equal(account.id))

View file

@ -41,19 +41,16 @@ class CategoryStore extends NylasStore
# Public: Returns all of the standard categories for the current account. # Public: Returns all of the standard categories for the current account.
# #
standardCategories: (accountOrId) -> standardCategories: (accountOrId) ->
return [] unless accountOrId @_standardCategories[asAccountId(accountOrId)] ? []
@_standardCategories[asAccountId(accountOrId)]
hiddenCategories: (accountOrId) -> hiddenCategories: (accountOrId) ->
return [] unless accountOrId @_hiddenCategories[asAccountId(accountOrId)] ? []
@_hiddenCategories[asAccountId(accountOrId)]
# Public: Returns all of the categories that are not part of the standard # Public: Returns all of the categories that are not part of the standard
# category set. # category set.
# #
userCategories: (accountOrId) -> userCategories: (accountOrId) ->
return [] unless accountOrId @_userCategories[asAccountId(accountOrId)] ? []
@_userCategories[asAccountId(accountOrId)]
# Public: Returns the Folder or Label object for a standard category name and # Public: Returns the Folder or Label object for a standard category name and
# for a given account. # for a given account.

View file

@ -370,7 +370,7 @@ class DraftStore
_onPopoutBlankDraft: => _onPopoutBlankDraft: =>
# TODO Remove this when we add account selector inside composer # TODO Remove this when we add account selector inside composer
account = FocusedPerspectiveStore.current()?.account account = FocusedPerspectiveStore.current().account
account ?= AccountStore.accounts()[0] account ?= AccountStore.accounts()[0]
draft = new Message draft = new Message
@ -408,7 +408,7 @@ class DraftStore
_onHandleMailtoLink: (event, urlString) => _onHandleMailtoLink: (event, urlString) =>
# TODO Remove this when we add account selector inside composer # TODO Remove this when we add account selector inside composer
account = FocusedPerspectiveStore.current()?.account account = FocusedPerspectiveStore.current().account
account ?= AccountStore.accounts()[0] account ?= AccountStore.accounts()[0]
try try

View file

@ -25,7 +25,7 @@ class UnreadBadgeStore extends NylasStore
@_count @_count
_updateCount: => _updateCount: =>
account = FocusedPerspectiveStore.current()?.account account = FocusedPerspectiveStore.current().account
category = CategoryStore.getStandardCategory(account, 'inbox') category = CategoryStore.getStandardCategory(account, 'inbox')
if category if category
count = ThreadCountsStore.unreadCountForCategoryId(category.id) ? 0 count = ThreadCountsStore.unreadCountForCategoryId(category.id) ? 0

View file

@ -55,7 +55,7 @@ class WorkspaceStore extends NylasStore
'navigation:go-to-label' : => ## TODO 'navigation:go-to-label' : => ## TODO
_setMailViewByName: (categoryName) -> _setMailViewByName: (categoryName) ->
account = FocusedPerspectiveStore.current()?.account account = FocusedPerspectiveStore.current().account
category = CategoryStore.getStandardCategory(account, categoryName) category = CategoryStore.getStandardCategory(account, categoryName)
return unless category return unless category
view = MailboxPerspective.forCategory(category) view = MailboxPerspective.forCategory(category)