mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-04 12:05:04 +08:00
fix(tracking): Remove hardcoded references to tracking plugin ids
- Adds a helper in the package manager to get the id of a plugin
This commit is contained in:
parent
6d7dec3b0e
commit
544d27bca8
3 changed files with 11 additions and 11 deletions
|
@ -13,14 +13,7 @@ import MultiSendToIndividualTask from './multi-send-to-individual-task';
|
|||
import MultiSendSessionCloseTask from './multi-send-session-close-task';
|
||||
import SyncbackMetadataTask from './syncback-metadata-task';
|
||||
import NotifyPluginsOfSendTask from './notify-plugins-of-send-task';
|
||||
let OPEN_TRACKING_ID = null;
|
||||
let LINK_TRACKING_ID = null;
|
||||
try {
|
||||
OPEN_TRACKING_ID = require('../../../internal_packages/open-tracking/lib/open-tracking-constants').PLUGIN_ID;
|
||||
LINK_TRACKING_ID = require('../../../internal_packages/link-tracking/lib/link-tracking-constants').PLUGIN_ID;
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
|
||||
// TODO
|
||||
// Refactor this to consolidate error handling across all Sending tasks
|
||||
|
@ -67,9 +60,11 @@ export default class SendDraftTask extends BaseDraftTask {
|
|||
}
|
||||
|
||||
sendMessage = () => {
|
||||
const openTrackingId = NylasEnv.packages.pluginIdFor('open-tracking')
|
||||
const linkTrackingId = NylasEnv.packages.pluginIdFor('link-tracking')
|
||||
const shouldMultiSend = (
|
||||
this.multiSend && OPEN_TRACKING_ID && LINK_TRACKING_ID &&
|
||||
(this.draft.metadataForPluginId(OPEN_TRACKING_ID) || this.draft.metadataForPluginId(LINK_TRACKING_ID)) &&
|
||||
this.multiSend && openTrackingId && linkTrackingId &&
|
||||
(this.draft.metadataForPluginId(openTrackingId) || this.draft.metadataForPluginId(linkTrackingId)) &&
|
||||
AccountStore.accountForId(this.draft.accountId).provider !== "eas"
|
||||
)
|
||||
if (shouldMultiSend) {
|
||||
|
|
|
@ -55,6 +55,11 @@ class PackageManager
|
|||
@packageActivators = []
|
||||
@registerPackageActivator(this, ['nylas'])
|
||||
|
||||
|
||||
pluginIdFor: (pluginName) =>
|
||||
env = NylasEnv.config.get("env")
|
||||
return @loadedPackages[pluginName]?.metadata.appId?[env]
|
||||
|
||||
###
|
||||
Section: Event Subscription
|
||||
###
|
||||
|
|
2
src/pro
2
src/pro
|
@ -1 +1 @@
|
|||
Subproject commit b9014953775087f42caf0d2a29b2d7b00506e5ca
|
||||
Subproject commit d2d8de3574117d6990a8144e6c2f6fc661f61a27
|
Loading…
Reference in a new issue