mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
4f34c8403f
Summary: This diff centralizes logic for creating common tasks for things like moving to trash, archive, etc. TaskFactory exposes a set of convenience methods and hides the whole "and also remove the current label" business from the user. This diff also formally separates the concept of "moving to trash" and "archiving" so that "remove" isn't used in an unclear way. I also refactored where selection is managed. Previously you'd fire some action like archiveSelection and it'd clear the selection, but if you selected some items and used another method to archive a few, they were still selected. The selection is now bound to the ModelView as intended, so if items are removed from the modelView, they are removed from it's attached selection. This means that it shouldn't /technically/ be possible to have selected items which are not in view. I haven't refactored the tests yet. They are likely broken... Fix next/prev logic Test Plan: Run tests Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D2157
65 lines
2.3 KiB
CoffeeScript
65 lines
2.3 KiB
CoffeeScript
MessageList = require "./message-list"
|
|
MessageToolbarItems = require "./message-toolbar-items"
|
|
{ComponentRegistry,
|
|
MessageStore,
|
|
WorkspaceStore} = require 'nylas-exports'
|
|
|
|
{SidebarContactCard,
|
|
SidebarSpacer,
|
|
SidebarContactList} = require "./sidebar-components"
|
|
|
|
ThreadStarButton = require './thread-star-button'
|
|
ThreadArchiveButton = require './thread-archive-button'
|
|
ThreadTrashButton = require './thread-trash-button'
|
|
ThreadToggleUnreadButton = require './thread-toggle-unread-button'
|
|
|
|
AutolinkerExtension = require './plugins/autolinker-extension'
|
|
TrackingPixelsExtension = require './plugins/tracking-pixels-extension'
|
|
|
|
module.exports =
|
|
item: null # The DOM item the main React component renders into
|
|
|
|
activate: (@state={}) ->
|
|
# Register Message List Actions we provide globally
|
|
ComponentRegistry.register MessageList,
|
|
location: WorkspaceStore.Location.MessageList
|
|
|
|
ComponentRegistry.register MessageToolbarItems,
|
|
location: WorkspaceStore.Location.MessageList.Toolbar
|
|
|
|
ComponentRegistry.register SidebarContactCard,
|
|
location: WorkspaceStore.Location.MessageListSidebar
|
|
ComponentRegistry.register SidebarSpacer,
|
|
location: WorkspaceStore.Location.MessageListSidebar
|
|
ComponentRegistry.register SidebarContactList,
|
|
location: WorkspaceStore.Location.MessageListSidebar
|
|
|
|
ComponentRegistry.register ThreadStarButton,
|
|
role: 'message:Toolbar'
|
|
|
|
ComponentRegistry.register ThreadArchiveButton,
|
|
role: 'message:Toolbar'
|
|
|
|
ComponentRegistry.register ThreadTrashButton,
|
|
role: 'message:Toolbar'
|
|
|
|
ComponentRegistry.register ThreadToggleUnreadButton,
|
|
role: 'message:Toolbar'
|
|
|
|
MessageStore.registerExtension(AutolinkerExtension)
|
|
MessageStore.registerExtension(TrackingPixelsExtension)
|
|
|
|
deactivate: ->
|
|
ComponentRegistry.unregister MessageList
|
|
ComponentRegistry.unregister ThreadStarButton
|
|
ComponentRegistry.unregister ThreadArchiveButton
|
|
ComponentRegistry.unregister ThreadTrashButton
|
|
ComponentRegistry.unregister ThreadToggleUnreadButton
|
|
ComponentRegistry.unregister MessageToolbarItems
|
|
ComponentRegistry.unregister SidebarContactCard
|
|
ComponentRegistry.unregister SidebarSpacer
|
|
ComponentRegistry.unregister SidebarContactList
|
|
MessageStore.unregisterExtension(AutolinkerExtension)
|
|
MessageStore.unregisterExtension(TrackingPixelsExtension)
|
|
|
|
serialize: -> @state
|