mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-06 11:16:10 +08:00
fix(perspective): Always pop to root sheet when changing #2125
This commit is contained in:
parent
9d623dec12
commit
4c00cccbee
3 changed files with 14 additions and 6 deletions
|
@ -479,6 +479,13 @@ class Actions
|
|||
###
|
||||
@popSheet: ActionScopeWindow
|
||||
|
||||
###
|
||||
Public: Pop the to the root sheet currently selected.
|
||||
|
||||
*Scope: Window*
|
||||
###
|
||||
@popToRootSheet: ActionScopeWindow
|
||||
|
||||
###
|
||||
Public: Push a sheet of a specific type onto the Sheet stack maintained by the
|
||||
{WorkspaceStore}. Note that sheets have no state. To show a *specific* thread,
|
||||
|
|
|
@ -60,7 +60,6 @@ class FocusedPerspectiveStore extends NylasStore
|
|||
@_setPerspective(@_defaultPerspective(accountIds))
|
||||
|
||||
_onFocusPerspective: (perspective) =>
|
||||
return if perspective.isEqual(@_current)
|
||||
@_setPerspective(perspective)
|
||||
|
||||
_onFocusAccounts: (accountsOrIds) =>
|
||||
|
@ -72,18 +71,20 @@ class FocusedPerspectiveStore extends NylasStore
|
|||
return MailboxPerspective.forInbox(accounts)
|
||||
|
||||
_setPerspective: (perspective) ->
|
||||
return if perspective?.isEqual(@_current)
|
||||
NylasEnv.savedState.perspective = perspective.toJSON()
|
||||
@_current = perspective
|
||||
@trigger()
|
||||
unless perspective.isEqual(@_current)
|
||||
NylasEnv.savedState.perspective = perspective.toJSON()
|
||||
@_current = perspective
|
||||
@trigger()
|
||||
|
||||
if perspective.drafts
|
||||
desired = WorkspaceStore.Sheet.Drafts
|
||||
else
|
||||
desired = WorkspaceStore.Sheet.Threads
|
||||
|
||||
# Always switch to the correct sheet and pop to root when perspective set
|
||||
if desired and WorkspaceStore.rootSheet() isnt desired
|
||||
Actions.selectRootSheet(desired)
|
||||
Actions.popToRootSheet()
|
||||
|
||||
_setPerspectiveByName: (categoryName) ->
|
||||
categories = @_current.accountIds.map (aid) ->
|
||||
|
|
|
@ -25,8 +25,8 @@ class WorkspaceStore extends NylasStore
|
|||
@listenTo Actions.setFocus, @_onSetFocus
|
||||
@listenTo Actions.toggleWorkspaceLocationHidden, @_onToggleLocationHidden
|
||||
@listenTo Actions.popSheet, @popSheet
|
||||
@listenTo Actions.popToRootSheet, @popToRootSheet
|
||||
@listenTo Actions.pushSheet, @pushSheet
|
||||
@listenTo Actions.focusMailboxPerspective, @popToRootSheet
|
||||
|
||||
{windowType} = NylasEnv.getLoadSettings()
|
||||
unless windowType is 'onboarding'
|
||||
|
|
Loading…
Add table
Reference in a new issue