mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 13:44:41 +08:00
55bf203596
Summary: Also, maintain the perspective that the thread was opened in, so that the proper messages are hidden (e.g. hide deleted messages when opened from the inbox, but not when opened from the trash folder) Test Plan: Tested locally Reviewers: juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3366
47 lines
1.9 KiB
CoffeeScript
47 lines
1.9 KiB
CoffeeScript
{MailboxPerspective,
|
|
ComponentRegistry,
|
|
ExtensionRegistry,
|
|
WorkspaceStore,
|
|
DatabaseStore,
|
|
Actions,
|
|
Thread} = require 'nylas-exports'
|
|
|
|
MessageList = require("./message-list")
|
|
MessageListHiddenMessagesToggle = require('./message-list-hidden-messages-toggle').default
|
|
|
|
SidebarPluginContainer = require "./sidebar-plugin-container"
|
|
SidebarParticipantPicker = require('./sidebar-participant-picker').default
|
|
|
|
module.exports =
|
|
activate: ->
|
|
if NylasEnv.isMainWindow()
|
|
# Register Message List Actions we provide globally
|
|
ComponentRegistry.register MessageList,
|
|
location: WorkspaceStore.Location.MessageList
|
|
|
|
ComponentRegistry.register SidebarParticipantPicker,
|
|
location: WorkspaceStore.Location.MessageListSidebar
|
|
|
|
ComponentRegistry.register SidebarPluginContainer,
|
|
location: WorkspaceStore.Location.MessageListSidebar
|
|
|
|
ComponentRegistry.register MessageListHiddenMessagesToggle,
|
|
role: 'MessageListHeaders'
|
|
else
|
|
# This is for the thread-popout window.
|
|
{threadId, perspectiveJSON} = NylasEnv.getWindowProps()
|
|
ComponentRegistry.register(MessageList, {location: WorkspaceStore.Location.Center})
|
|
# We need to locate the thread and focus it so that the MessageList displays it
|
|
DatabaseStore.find(Thread, threadId).then((thread) =>
|
|
Actions.setFocus({collection: 'thread', item: thread})
|
|
)
|
|
# Set the focused perspective and hide the proper messages
|
|
# (e.g. we should hide deleted items from the inbox, but not from trash)
|
|
Actions.focusMailboxPerspective(MailboxPerspective.fromJSON(perspectiveJSON))
|
|
ComponentRegistry.register MessageListHiddenMessagesToggle,
|
|
role: 'MessageListHeaders'
|
|
|
|
deactivate: ->
|
|
ComponentRegistry.unregister MessageList
|
|
ComponentRegistry.unregister SidebarPluginContainer
|
|
ComponentRegistry.unregister SidebarParticipantPicker
|