mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
feat(syncing-server): remove google drive backup failed event in favour of email requested
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
import { DomainEventInterface } from './DomainEventInterface'
|
||||
|
||||
import { GoogleDriveBackupFailedEventPayload } from './GoogleDriveBackupFailedEventPayload'
|
||||
|
||||
export interface GoogleDriveBackupFailedEvent extends DomainEventInterface {
|
||||
type: 'GOOGLE_DRIVE_BACKUP_FAILED'
|
||||
payload: GoogleDriveBackupFailedEventPayload
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
export interface GoogleDriveBackupFailedEventPayload {
|
||||
muteCloudEmailsSettingUuid: string
|
||||
extensionSettingUuid?: string
|
||||
email: string
|
||||
}
|
||||
@@ -34,8 +34,6 @@ export * from './Event/FileRemovedEvent'
|
||||
export * from './Event/FileRemovedEventPayload'
|
||||
export * from './Event/FileUploadedEvent'
|
||||
export * from './Event/FileUploadedEventPayload'
|
||||
export * from './Event/GoogleDriveBackupFailedEvent'
|
||||
export * from './Event/GoogleDriveBackupFailedEventPayload'
|
||||
export * from './Event/ItemDumpedEvent'
|
||||
export * from './Event/ItemDumpedEventPayload'
|
||||
export * from './Event/ItemRevisionCreationRequestedEvent'
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { html } from './google-drive-backup-failed.html'
|
||||
|
||||
export function getSubject(): string {
|
||||
return 'Failed Daily Backup to Google Drive Sync'
|
||||
}
|
||||
|
||||
export function getBody(): string {
|
||||
return html
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
export const html = `<p>Hello,</p>
|
||||
<p>We recently tried backing up your data to <strong>Google Drive Sync</strong>, but an issue prevented us from
|
||||
doing
|
||||
so.</p>
|
||||
<p>
|
||||
The usual cause is an expired or revoked token from your sync provider. Please follow
|
||||
<a href='https://standardnotes.com/help/27/how-do-i-enable-dropbox-google-drive-or-onedrive-backups'>these
|
||||
instructions</a>
|
||||
to use CloudLink on the web or desktop Standard Notes application to uninstall then reinstall this sync provider.
|
||||
</p>
|
||||
<p>
|
||||
We apologize for any inconvenience this may cause.
|
||||
If you have any questions, please feel free to reply directly to this email.
|
||||
</p>
|
||||
<p>
|
||||
Thanks,
|
||||
<br>SN</br>
|
||||
</p>
|
||||
<a href='https://app.standardnotes.com/?settings=backups'>Mute these emails</a>`
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
DuplicateItemSyncedEvent,
|
||||
EmailArchiveExtensionSyncedEvent,
|
||||
EmailBackupAttachmentCreatedEvent,
|
||||
GoogleDriveBackupFailedEvent,
|
||||
EmailRequestedEvent,
|
||||
ItemDumpedEvent,
|
||||
ItemRevisionCreationRequestedEvent,
|
||||
ItemsSyncedEvent,
|
||||
@@ -149,21 +149,24 @@ export class DomainEventFactory implements DomainEventFactoryInterface {
|
||||
}
|
||||
}
|
||||
|
||||
createGoogleDriveBackupFailedEvent(muteCloudEmailsSettingUuid: string, email: string): GoogleDriveBackupFailedEvent {
|
||||
createEmailRequestedEvent(dto: {
|
||||
userEmail: string
|
||||
messageIdentifier: string
|
||||
level: string
|
||||
body: string
|
||||
subject: string
|
||||
}): EmailRequestedEvent {
|
||||
return {
|
||||
type: 'GOOGLE_DRIVE_BACKUP_FAILED',
|
||||
type: 'EMAIL_REQUESTED',
|
||||
createdAt: this.timer.getUTCDate(),
|
||||
meta: {
|
||||
correlation: {
|
||||
userIdentifier: email,
|
||||
userIdentifier: dto.userEmail,
|
||||
userIdentifierType: 'email',
|
||||
},
|
||||
origin: DomainEventService.SyncingServer,
|
||||
},
|
||||
payload: {
|
||||
muteCloudEmailsSettingUuid,
|
||||
email,
|
||||
},
|
||||
payload: dto,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
DuplicateItemSyncedEvent,
|
||||
EmailArchiveExtensionSyncedEvent,
|
||||
EmailBackupAttachmentCreatedEvent,
|
||||
GoogleDriveBackupFailedEvent,
|
||||
EmailRequestedEvent,
|
||||
ItemDumpedEvent,
|
||||
ItemRevisionCreationRequestedEvent,
|
||||
ItemsSyncedEvent,
|
||||
@@ -16,7 +16,13 @@ import {
|
||||
export interface DomainEventFactoryInterface {
|
||||
createUserContentSizeRecalculationRequestedEvent(userUuid: string): UserContentSizeRecalculationRequestedEvent
|
||||
createDropboxBackupFailedEvent(muteCloudEmailsSettingUuid: string, email: string): DropboxBackupFailedEvent
|
||||
createGoogleDriveBackupFailedEvent(muteCloudEmailsSettingUuid: string, email: string): GoogleDriveBackupFailedEvent
|
||||
createEmailRequestedEvent(dto: {
|
||||
userEmail: string
|
||||
messageIdentifier: string
|
||||
level: string
|
||||
body: string
|
||||
subject: string
|
||||
}): EmailRequestedEvent
|
||||
createOneDriveBackupFailedEvent(muteCloudEmailsSettingUuid: string, email: string): OneDriveBackupFailedEvent
|
||||
createItemsSyncedEvent(dto: {
|
||||
userUuid: string
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { KeyParamsData } from '@standardnotes/responses'
|
||||
import { DomainEventInterface, DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
||||
import { EmailLevel } from '@standardnotes/domain-core'
|
||||
import { AxiosInstance } from 'axios'
|
||||
import { inject, injectable } from 'inversify'
|
||||
import { Logger } from 'winston'
|
||||
@@ -10,6 +11,7 @@ import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
|
||||
import { ExtensionName } from './ExtensionName'
|
||||
import { ExtensionsHttpServiceInterface } from './ExtensionsHttpServiceInterface'
|
||||
import { SendItemsToExtensionsServerDTO } from './SendItemsToExtensionsServerDTO'
|
||||
import { getBody, getSubject } from '../Email/GoogleDriveBackupFailed'
|
||||
|
||||
@injectable()
|
||||
export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
||||
@@ -121,7 +123,13 @@ export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
||||
case 'DROPBOX':
|
||||
return this.domainEventFactory.createDropboxBackupFailedEvent(muteCloudEmailsSettingUuid, email)
|
||||
case 'GOOGLE_DRIVE':
|
||||
return this.domainEventFactory.createGoogleDriveBackupFailedEvent(muteCloudEmailsSettingUuid, email)
|
||||
return this.domainEventFactory.createEmailRequestedEvent({
|
||||
userEmail: email,
|
||||
level: EmailLevel.LEVELS.FailedCloudBackup,
|
||||
body: getBody(),
|
||||
messageIdentifier: 'FAILED_GOOGLE_DRIVE_BACKUP',
|
||||
subject: getSubject(),
|
||||
})
|
||||
case 'ONE_DRIVE':
|
||||
return this.domainEventFactory.createOneDriveBackupFailedEvent(muteCloudEmailsSettingUuid, email)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user