2015-12-01 03:43:49 +08:00
|
|
|
{PreferencesUIStore,
|
2015-11-24 04:20:51 +08:00
|
|
|
Actions,
|
|
|
|
WorkspaceStore,
|
|
|
|
ComponentRegistry} = require 'nylas-exports'
|
2015-11-29 01:04:55 +08:00
|
|
|
{ipcRenderer} = require 'electron'
|
2015-10-01 03:29:56 +08:00
|
|
|
|
2015-08-15 06:40:11 +08:00
|
|
|
module.exports =
|
2015-11-24 04:20:51 +08:00
|
|
|
|
|
|
|
activate: ->
|
2015-08-15 06:40:11 +08:00
|
|
|
React = require 'react'
|
|
|
|
|
2015-12-01 03:43:49 +08:00
|
|
|
Cfg = PreferencesUIStore.TabItem
|
2015-10-30 05:20:41 +08:00
|
|
|
|
2015-12-01 03:43:49 +08:00
|
|
|
PreferencesUIStore.registerPreferencesTab(new Cfg {
|
|
|
|
tabId: 'General'
|
2015-10-30 05:20:41 +08:00
|
|
|
displayName: 'General'
|
2015-08-15 06:40:11 +08:00
|
|
|
component: require './tabs/preferences-general'
|
2015-10-30 05:20:41 +08:00
|
|
|
order: 1
|
2015-08-15 06:40:11 +08:00
|
|
|
})
|
2015-12-01 03:43:49 +08:00
|
|
|
PreferencesUIStore.registerPreferencesTab(new Cfg {
|
|
|
|
tabId: 'Accounts'
|
2015-10-30 05:20:41 +08:00
|
|
|
displayName: 'Accounts'
|
2015-08-15 06:40:11 +08:00
|
|
|
component: require './tabs/preferences-accounts'
|
2015-10-30 05:20:41 +08:00
|
|
|
order: 2
|
2015-08-15 06:40:11 +08:00
|
|
|
})
|
2015-12-01 03:43:49 +08:00
|
|
|
PreferencesUIStore.registerPreferencesTab(new Cfg {
|
|
|
|
tabId: 'Shortcuts'
|
2015-10-30 05:20:41 +08:00
|
|
|
displayName: 'Shortcuts'
|
2015-08-15 06:40:11 +08:00
|
|
|
component: require './tabs/preferences-keymaps'
|
2015-10-30 05:20:41 +08:00
|
|
|
order: 3
|
2015-08-15 06:40:11 +08:00
|
|
|
})
|
feat(mail-rules): Per-account mail rules filter incoming, existing mail
Summary:
Originally, this was going to be a totally independent package, but
I wasn't able to isolate the functionality and get it tied in to
the delta-stream consumption. Here's how it currently works:
- The preferences package has a new tab which allows you to edit
mail filters. Filters are saved in a new core store, and a new
stock component (ScenarioEditor) renders the editor. The editor
takes a set of templates that define a value space, and outputs
a valid set of values.
- A new MailFilterProcessor takes messages and creates tasks to
apply the actions from the MailFiltersStore.
- The worker-sync package now uses the MailFilterProcessor to
apply filters /before/ it calls didPassivelyReceiveNewModels,
so filtrs are applied before any notifications are created.
- A new task, ReprocessMailFiltersTask allows you to run filters
on all of your existing mail. It leverages the existing TaskQueue
architecture to: a) resume where it left off if you quit midway,
b) be queryable (for status) from all windows and c) cancelable.
The TaskQueue is a bit strange because it runs performLocal and
performRemote very differently, and I had to use `performRemote`.
(todo refactor soon.)
This diff also changes the EditableList a bit to behave like a
controlled component and render focused / unfocused states.
Test Plan: Run tests, only for actual filter processing atm.
Reviewers: juan, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D2379
2015-12-23 15:19:32 +08:00
|
|
|
PreferencesUIStore.registerPreferencesTab(new Cfg {
|
|
|
|
tabId: 'Mail Rules'
|
|
|
|
displayName: 'Mail Rules'
|
|
|
|
component: require './tabs/preferences-mail-rules'
|
|
|
|
componentRequiresAccount: true
|
|
|
|
order: 4
|
|
|
|
})
|
2015-11-24 04:20:51 +08:00
|
|
|
|
|
|
|
WorkspaceStore.defineSheet 'Preferences', {},
|
|
|
|
split: ['Preferences']
|
|
|
|
list: ['Preferences']
|
|
|
|
|
|
|
|
PreferencesRoot = require('./preferences-root')
|
|
|
|
ComponentRegistry.register PreferencesRoot,
|
|
|
|
location: WorkspaceStore.Location.Preferences
|
2015-10-01 03:29:56 +08:00
|
|
|
|
|
|
|
Actions.openPreferences.listen(@_openPreferences)
|
2015-11-24 14:09:17 +08:00
|
|
|
ipcRenderer.on 'open-preferences', => @_openPreferences()
|
2015-10-01 03:29:56 +08:00
|
|
|
|
2015-11-24 04:20:51 +08:00
|
|
|
_openPreferences: ->
|
2015-11-29 01:04:55 +08:00
|
|
|
ipcRenderer.send 'command', 'application:show-main-window'
|
|
|
|
if WorkspaceStore.topSheet() isnt WorkspaceStore.Sheet.Preferences
|
|
|
|
Actions.pushSheet(WorkspaceStore.Sheet.Preferences)
|
2015-08-15 06:40:11 +08:00
|
|
|
|
|
|
|
deactivate: ->
|
|
|
|
|
|
|
|
serialize: -> @state
|