Mailspring/internal_packages/preferences/lib/tabs/preferences-general.jsx

91 lines
2.5 KiB
React
Raw Normal View History

/* eslint global-require: 0*/
import React from 'react';
import {Actions} from 'nylas-exports'
import ConfigSchemaItem from './config-schema-item';
import WorkspaceSection from './workspace-section';
import SendingSection from './sending-section';
class PreferencesGeneral extends React.Component {
static displayName = 'PreferencesGeneral'
2016-05-07 07:23:48 +08:00
static propTypes = {
config: React.PropTypes.object,
configSchema: React.PropTypes.object,
};
2016-05-07 07:23:48 +08:00
_reboot = () => {
const app = require('electron').remote.app;
app.relaunch()
app.quit()
}
_resetAccountsAndSettings = () => {
const rimraf = require('rimraf')
rimraf(NylasEnv.getConfigDirPath(), {disableGlob: true}, (err) => {
if (err) console.log(err)
else this._reboot()
})
}
_resetEmailCache = () => {
Actions.resetEmailCache()
}
render() {
return (
<div className="container-general" style={{maxWidth: 600}}>
<WorkspaceSection config={this.props.config} configSchema={this.props.configSchema} />
<ConfigSchemaItem
configSchema={this.props.configSchema.properties.notifications}
keyName="Notifications"
keyPath="core.notifications"
config={this.props.config}
/>
<div className="platform-note platform-linux-only">
N1 desktop notifications on Linux require Zenity. You may need to install
it with your package manager (i.e., <code>sudo apt-get install zenity</code>).
</div>
<ConfigSchemaItem
configSchema={this.props.configSchema.properties.reading}
keyName="Reading"
keyPath="core.reading"
config={this.props.config}
/>
<ConfigSchemaItem
configSchema={this.props.configSchema.properties.composing}
keyName="Composing"
keyPath="core.composing"
config={this.props.config}
/>
feat(undo-send): Add undo send Summary: Add ability to undo send. We decided to make undo send completely client side for a couple of reasons. If we rely on send-later for undo-send, we would be giving /all/ send load to our send-later backend. If this increases the send-later load too much, it might cause delays in the regular send-later functionality and potentially other plugins like snooze that run under the same service. We would also need to rely on the network to be able to cancel a send, which would make it unusable offline or hard to debug if that specific request fails for any given reason. This commit also refactors the way `ComposerExtension.sendActionConfig` works. The method has been renamed and now must return an array of send actions. Also, all of the business logic to handle different send actions registered by extensions has been pieced apart from the SendActionButton and into a new SendActionStore. This also enables undo send to undo custom send actions registered by extensions. Along the way, this also fixes a pending TODO to show all registered custom send actions in the preferences for choosing the preferred send action for sending. Undo send works via a task, so in case N1 closes before send goes through, it will still be persisted to the task queue and restored when opened again. Undoing a send means dequeuing this task. Test Plan: Manual Reviewers: jackie, bengotow, halla, evan Reviewed By: bengotow, halla, evan Differential Revision: https://phab.nylas.com/D3361
2016-10-22 02:48:04 +08:00
<SendingSection
config={this.props.config}
configSchema={this.props.configSchema}
/>
<ConfigSchemaItem
configSchema={this.props.configSchema.properties.attachments}
keyName="Attachments"
keyPath="core.attachments"
config={this.props.config}
/>
<div className="local-data">
<h6>Local Data</h6>
<div className="btn" onClick={this._resetEmailCache}>Reset Email Cache</div>
<div className="btn" onClick={this._resetAccountsAndSettings}>Reset Accounts and Settings</div>
</div>
</div>
)
}
}
2016-05-07 07:23:48 +08:00
export default PreferencesGeneral;