fix: email sending procedure to not include creating mute_marketing_emails anymore
This commit is contained in:
parent
250f408228
commit
f49299fa91
1 changed files with 2 additions and 17 deletions
|
@ -18,8 +18,6 @@ import { UserSubscriptionRepositoryInterface } from '../src/Domain/Subscription/
|
|||
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
||||
import { MuteMarketingEmailsOption, SettingName } from '@standardnotes/settings'
|
||||
import { EmailMessageIdentifier } from '@standardnotes/common'
|
||||
import { User } from '../src/Domain/User/User'
|
||||
import { EncryptionVersion } from '../src/Domain/Encryption/EncryptionVersion'
|
||||
import { TimerInterface } from '@standardnotes/time'
|
||||
|
||||
const inputArgs = process.argv.slice(2)
|
||||
|
@ -43,30 +41,17 @@ const sendEmailCampaign = async (
|
|||
objectMode: true,
|
||||
transform: async (rawUserData, _encoding, callback) => {
|
||||
try {
|
||||
let emailsMutedSetting = await settingService.findSettingWithDecryptedValue({
|
||||
const emailsMutedSetting = await settingService.findSettingWithDecryptedValue({
|
||||
userUuid: rawUserData.user_uuid,
|
||||
settingName: SettingName.MuteMarketingEmails,
|
||||
})
|
||||
|
||||
if (emailsMutedSetting !== null) {
|
||||
if (emailsMutedSetting === null || emailsMutedSetting.value === MuteMarketingEmailsOption.Muted) {
|
||||
callback()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
const user = (await userRepository.findOneByUuid(rawUserData.user_uuid)) as User
|
||||
|
||||
const { setting } = await settingService.createOrReplace({
|
||||
user,
|
||||
props: {
|
||||
name: SettingName.MuteMarketingEmails,
|
||||
unencryptedValue: MuteMarketingEmailsOption.NotMuted,
|
||||
serverEncryptionVersion: EncryptionVersion.Unencrypted,
|
||||
sensitive: false,
|
||||
},
|
||||
})
|
||||
emailsMutedSetting = setting
|
||||
|
||||
let activeSubscription = false
|
||||
let subscriptionPlanName = null
|
||||
|
||||
|
|
Loading…
Reference in a new issue