mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-05 07:35:34 +08:00
fix(search): Reliably clear back to previously selected Tag when you click "X"
Fixes T1173
This commit is contained in:
parent
1c901e090a
commit
41caae2d2f
2 changed files with 12 additions and 8 deletions
|
@ -85,7 +85,9 @@ ThreadListStore = Reflux.createStore
|
|||
|
||||
# Inbound Events
|
||||
|
||||
_onTagChanged: -> @createView()
|
||||
_onTagChanged: ->
|
||||
@createView()
|
||||
|
||||
_onNamespaceChanged: ->
|
||||
namespaceId = NamespaceStore.current()?.id
|
||||
namespaceMatcher = (m) ->
|
||||
|
|
|
@ -3,6 +3,8 @@ NamespaceStore = require './namespace-store'
|
|||
Actions = require '../actions'
|
||||
Tag = require '../models/tag'
|
||||
|
||||
InboxTag = new Tag(id: 'inbox', name: 'inbox')
|
||||
|
||||
FocusedTagStore = Reflux.createStore
|
||||
init: ->
|
||||
@_resetInstanceVars()
|
||||
|
@ -12,12 +14,12 @@ FocusedTagStore = Reflux.createStore
|
|||
@listenTo Actions.searchQueryCommitted, @_onSearchQueryCommitted
|
||||
|
||||
_resetInstanceVars: ->
|
||||
@_tag = new Tag(id: 'inbox', name: 'inbox')
|
||||
@_tag = InboxTag
|
||||
|
||||
# Inbound Events
|
||||
|
||||
_onClearTag: ->
|
||||
@_setTag(new Tag(id: 'inbox', name: 'inbox'))
|
||||
@_setTag(InboxTag)
|
||||
|
||||
_onFocusTag: (tag) ->
|
||||
return if @_tag?.id is tag?.id
|
||||
|
@ -27,12 +29,12 @@ FocusedTagStore = Reflux.createStore
|
|||
|
||||
@_setTag(tag)
|
||||
|
||||
_onSearchQueryCommitted: (_query) ->
|
||||
if _query
|
||||
@_oldTag = @_tag
|
||||
_onSearchQueryCommitted: (query) ->
|
||||
if query and @_tag
|
||||
@_tagBeforeSearch = @_tag
|
||||
@_setTag(null)
|
||||
else if @_oldTag
|
||||
@_setTag(@_oldTag)
|
||||
else if not query
|
||||
@_setTag(@_tagBeforeSearch ? InboxTag)
|
||||
|
||||
_setTag: (tag) ->
|
||||
return if @_tag?.id is tag?.id
|
||||
|
|
Loading…
Reference in a new issue