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

This commit is contained in:
Ben Gotow 2016-01-18 01:31:35 -08:00
parent f1b4a23897
commit 99854add72
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
render: =>
return false unless FocusedPerspectiveStore.current()?.canArchiveThreads()
return false unless FocusedPerspectiveStore.current().canArchiveThreads()
<button className="btn btn-toolbar btn-archive"
style={order: -107}

View file

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

View file

@ -25,7 +25,7 @@ class DraftListStore extends NylasStore
_queryForCurrentAccount: =>
matchers = [Message.attributes.draft.equal(true)]
account = FocusedPerspectiveStore.current()?.account
account = FocusedPerspectiveStore.current().account
if account?
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.
#
standardCategories: (accountOrId) ->
return [] unless accountOrId
@_standardCategories[asAccountId(accountOrId)]
@_standardCategories[asAccountId(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
# category set.
#
userCategories: (accountOrId) ->
return [] unless accountOrId
@_userCategories[asAccountId(accountOrId)]
@_userCategories[asAccountId(accountOrId)] ? []
# Public: Returns the Folder or Label object for a standard category name and
# for a given account.

View file

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

View file

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

View file

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