mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 12:40:08 +08:00
f3caf0b561
Summary: We weren't removing the inbox category in the search perspective, so things weren't actually being archived. Test Plan: Run locally Reviewers: juan, evan Reviewed By: evan Maniphest Tasks: T7389 Differential Revision: https://phab.nylas.com/D3575
47 lines
1.2 KiB
JavaScript
47 lines
1.2 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({
|
|
threads: threads,
|
|
categoriesToAdd: (accountId) => {
|
|
const account = AccountStore.accountForId(accountId)
|
|
return [account.defaultFinishedCategory()]
|
|
},
|
|
categoriesToRemove: (accountId) => {
|
|
return [CategoryStore.getInboxCategory(accountId)]
|
|
},
|
|
})
|
|
}
|
|
}
|
|
|
|
export default SearchMailboxPerspective;
|