Mailspring/internal_packages/thread-search/lib/search-mailbox-perspective.es6
Juan Tejada f2e7ea4c4c feat(reminders): Add send reminders functionality
Summary: Add reminders plugin which lets you set reminder if you don't get a reply for a message within a specified time in the future

Test Plan: TODO

Reviewers: halla, bengotow, evan

Reviewed By: halla, bengotow, evan

Differential Revision: https://phab.nylas.com/D3356
2016-10-27 08:49:29 -07:00

46 lines
1.1 KiB
JavaScript

import _ from 'underscore'
import {AccountStore, 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()]
},
})
}
}
export default SearchMailboxPerspective;