mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 13:44:41 +08:00
72613baf5d
Summary:
This commit fixes 2 issues with signatures in the preferences:
- Creating a signature (via any of the create buttons) would create 2 signatures
- Trying to select accounts to associate with a signature in the preferences would not work (the account would not be selected)
This was a regression introduced in e638e94084 (diff-4f38fd25aa24b48a309354be643165d3R26)
3111c16 made it so we attempt to `activate` any Stores that are registered with
the StoreRegistry. When adding stores to `nylas-exports`, they are
automatically registered in the StoreRegistry. Given that the
`SignatureStore` is in `nylas-exports`, and consequently is registered in
the StoreRegistry, it would be `activate`d upon window boot.
However, we were also manually activating it inside `internal_packages/composer-signatures/lib/main.es6`.
This caused it to register listeners for every action **twice**. For
this reason, 2 signatures would be created when trying to create 1, and
an account would be immediately unselected after being selected int he
signatures dropdown in preferences.
(Other changes in this are just stylistic)
Test Plan: manual
Reviewers: spang, evan
Reviewed By: evan
Differential Revision: https://phab.nylas.com/D4043
31 lines
1,012 B
JavaScript
31 lines
1,012 B
JavaScript
import {PreferencesUIStore, ExtensionRegistry, ComponentRegistry} from 'nylas-exports';
|
|
|
|
import SignatureComposerExtension from './signature-composer-extension';
|
|
import SignatureComposerDropdown from './signature-composer-dropdown';
|
|
import PreferencesSignatures from "./preferences-signatures";
|
|
|
|
export function activate() {
|
|
this.preferencesTab = new PreferencesUIStore.TabItem({
|
|
tabId: "Signatures",
|
|
displayName: "Signatures",
|
|
component: PreferencesSignatures,
|
|
});
|
|
|
|
ExtensionRegistry.Composer.register(SignatureComposerExtension);
|
|
PreferencesUIStore.registerPreferencesTab(this.preferencesTab);
|
|
|
|
ComponentRegistry.register(SignatureComposerDropdown, {
|
|
role: 'Composer:FromFieldComponents',
|
|
});
|
|
}
|
|
|
|
export function deactivate() {
|
|
ExtensionRegistry.Composer.unregister(SignatureComposerExtension);
|
|
PreferencesUIStore.unregisterPreferencesTab(this.preferencesTab.sectionId);
|
|
|
|
ComponentRegistry.unregister(SignatureComposerDropdown);
|
|
}
|
|
|
|
export function serialize() {
|
|
return {};
|
|
}
|