diff --git a/internal_packages/account-sidebar/lib/account-sidebar-store.coffee b/internal_packages/account-sidebar/lib/account-sidebar-store.coffee index c541a2170..1d69675b9 100644 --- a/internal_packages/account-sidebar/lib/account-sidebar-store.coffee +++ b/internal_packages/account-sidebar/lib/account-sidebar-store.coffee @@ -61,6 +61,7 @@ AccountSidebarStore = Reflux.createStore # Sort the main tags so they always appear in a standard order mainTags = _.sortBy mainTags, (tag) -> mainTagIDs.indexOf(tag.id) + mainTags.push new Tag(name: 'All Mail', id: '*') lastSections = @_sections @_sections = [ diff --git a/src/flux/stores/thread-store.coffee b/src/flux/stores/thread-store.coffee index 6865ad22c..264e85098 100644 --- a/src/flux/stores/thread-store.coffee +++ b/src/flux/stores/thread-store.coffee @@ -45,10 +45,12 @@ ThreadStore = Reflux.createStore start = Date.now() - DatabaseStore.findAll(Thread, [ - Thread.attributes.namespaceId.equal(@_namespaceId), - Thread.attributes.tags.contains(@_tagId) - ]).limit(100).then (items) => + matchers = [] + matchers.push Thread.attributes.namespaceId.equal(@_namespaceId) + if @_tagId and @_tagId isnt "*" + matchers.push Thread.attributes.tags.contains(@_tagId) + + DatabaseStore.findAll(Thread).where(matchers).limit(100).then (items) => # Now, fetch the messages for each thread. We could do this with a # complex join, but then we'd get thread columns repeated over and over. # This is reasonably fast because we don't store message bodies in messages @@ -122,7 +124,10 @@ ThreadStore = Reflux.createStore @_items = items doneLoading() else - atom.inbox.getThreads(@_namespaceId, {tag: @_tagId}, {success: doneLoading, error: doneLoading}) + params = {} + if @_tagId and @_tagId isnt "*" + params = {tag: @_tagId} + atom.inbox.getThreads(@_namespaceId, params, {success: doneLoading, error: doneLoading}) # Inbound Events