mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
a20b979208
Summary: Adds the following new events: - Threads Moved to Folder - isArchive - source - folderType - folderDisplayName - numThreads - numMessages - description - isUndo - Threads Changed Labels - isArchive - source - labelTypesToAdd - labelTypesToRemove - labelDisplayNamesToAdd - labelDisplayNamesToRemove - numThreads - numMessages - description - isUndo - Threads Starred - source - numThreads - description - isUndo - Threads Unstarred - source - numThreads - description - isUndo - Threads Marked as Read - source - numThreads - description - isUndo - Threads Marked as Unread - source - numThreads - description - isUndo Each new action has a "source" property that's one of the following: - Category Picker: New Category - Category Picker: Existing Category - Toolbar Button: Message List - Toolbar Button: Thread List - Send and Archive - Context Menu: Thread List - Thread List Icon - Quick Actions: Thread List - Swipe - Keyboard Shortcut - Dragged Out of List - Snooze Move - Important Icon - Label Remove Icon - Thread Selected - Mail Rules - Dragged Into List Test Plan: manual Reviewers: juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3760
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
import _ from 'underscore'
|
|
import {AccountStore, CategoryStore, TaskFactory, MailboxPerspective} from 'nylas-exports'
|
|
import SearchQuerySubscription from './search-query-subscription'
|
|
|
|
class SearchMailboxPerspective extends MailboxPerspective {
|
|
|
|
constructor(accountIds, searchQuery) {
|
|
super(accountIds)
|
|
this.searchQuery = searchQuery
|
|
this.name = 'Search'
|
|
|
|
if (!_.isString(this.searchQuery)) {
|
|
throw new Error("SearchMailboxPerspective: Expected a `string` search query")
|
|
}
|
|
}
|
|
|
|
emptyMessage() {
|
|
return "No search results available"
|
|
}
|
|
|
|
isEqual(other) {
|
|
return super.isEqual(other) && other.searchQuery === this.searchQuery
|
|
}
|
|
|
|
threads() {
|
|
return new SearchQuerySubscription(this.searchQuery, this.accountIds)
|
|
}
|
|
|
|
canReceiveThreadsFromAccountIds() {
|
|
return false
|
|
}
|
|
|
|
tasksForRemovingItems(threads) {
|
|
return TaskFactory.tasksForApplyingCategories({
|
|
source: "Dragged Out of List",
|
|
threads: threads,
|
|
categoriesToAdd: (accountId) => {
|
|
const account = AccountStore.accountForId(accountId)
|
|
return [account.defaultFinishedCategory()]
|
|
},
|
|
categoriesToRemove: (accountId) => {
|
|
return [CategoryStore.getInboxCategory(accountId)]
|
|
},
|
|
})
|
|
}
|
|
}
|
|
|
|
export default SearchMailboxPerspective;
|