From 92e66e04f7f51d37b465cff442ce47f6d6d7cadd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 22 Mar 2022 16:58:49 +0100 Subject: Rename studio to editor --- .../edition-finished-for-owner.ts | 57 ---------------------- .../lib/notifier/shared/video-publication/index.ts | 2 +- .../studio-edition-finished-for-owner.ts | 57 ++++++++++++++++++++++ 3 files changed, 58 insertions(+), 58 deletions(-) delete mode 100644 server/lib/notifier/shared/video-publication/edition-finished-for-owner.ts create mode 100644 server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts (limited to 'server/lib/notifier/shared/video-publication') diff --git a/server/lib/notifier/shared/video-publication/edition-finished-for-owner.ts b/server/lib/notifier/shared/video-publication/edition-finished-for-owner.ts deleted file mode 100644 index dec91f574..000000000 --- a/server/lib/notifier/shared/video-publication/edition-finished-for-owner.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { logger } from '@server/helpers/logger' -import { WEBSERVER } from '@server/initializers/constants' -import { UserModel } from '@server/models/user/user' -import { UserNotificationModel } from '@server/models/user/user-notification' -import { MUserDefault, MUserWithNotificationSetting, MVideoFullLight, UserNotificationModelForApi } from '@server/types/models' -import { UserNotificationType } from '@shared/models' -import { AbstractNotification } from '../common/abstract-notification' - -export class EditionFinishedForOwner extends AbstractNotification { - private user: MUserDefault - - async prepare () { - this.user = await UserModel.loadByVideoId(this.payload.id) - } - - log () { - logger.info('Notifying user %s its video edition %s is finished.', this.user.username, this.payload.url) - } - - getSetting (user: MUserWithNotificationSetting) { - return user.NotificationSetting.myVideoEditionFinished - } - - getTargetUsers () { - if (!this.user) return [] - - return [ this.user ] - } - - async createNotification (user: MUserWithNotificationSetting) { - const notification = await UserNotificationModel.create({ - type: UserNotificationType.MY_VIDEO_EDITION_FINISHED, - userId: user.id, - videoId: this.payload.id - }) - notification.Video = this.payload - - return notification - } - - createEmail (to: string) { - const videoUrl = WEBSERVER.URL + this.payload.getWatchStaticPath() - - return { - to, - subject: `Edition of your video ${this.payload.name} has finished`, - text: `Edition of your video ${this.payload.name} has finished.`, - locals: { - title: 'Video edition has finished', - action: { - text: 'View video', - url: videoUrl - } - } - } - } -} diff --git a/server/lib/notifier/shared/video-publication/index.ts b/server/lib/notifier/shared/video-publication/index.ts index 57f3443b9..5e92cb011 100644 --- a/server/lib/notifier/shared/video-publication/index.ts +++ b/server/lib/notifier/shared/video-publication/index.ts @@ -1,6 +1,6 @@ export * from './new-video-for-subscribers' -export * from './edition-finished-for-owner' export * from './import-finished-for-owner' export * from './owned-publication-after-auto-unblacklist' export * from './owned-publication-after-schedule-update' export * from './owned-publication-after-transcoding' +export * from './studio-edition-finished-for-owner' diff --git a/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts b/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts new file mode 100644 index 000000000..ee3027245 --- /dev/null +++ b/server/lib/notifier/shared/video-publication/studio-edition-finished-for-owner.ts @@ -0,0 +1,57 @@ +import { logger } from '@server/helpers/logger' +import { WEBSERVER } from '@server/initializers/constants' +import { UserModel } from '@server/models/user/user' +import { UserNotificationModel } from '@server/models/user/user-notification' +import { MUserDefault, MUserWithNotificationSetting, MVideoFullLight, UserNotificationModelForApi } from '@server/types/models' +import { UserNotificationType } from '@shared/models' +import { AbstractNotification } from '../common/abstract-notification' + +export class StudioEditionFinishedForOwner extends AbstractNotification { + private user: MUserDefault + + async prepare () { + this.user = await UserModel.loadByVideoId(this.payload.id) + } + + log () { + logger.info('Notifying user %s its video studio edition %s is finished.', this.user.username, this.payload.url) + } + + getSetting (user: MUserWithNotificationSetting) { + return user.NotificationSetting.myVideoStudioEditionFinished + } + + getTargetUsers () { + if (!this.user) return [] + + return [ this.user ] + } + + async createNotification (user: MUserWithNotificationSetting) { + const notification = await UserNotificationModel.create({ + type: UserNotificationType.MY_VIDEO_STUDIO_EDITION_FINISHED, + userId: user.id, + videoId: this.payload.id + }) + notification.Video = this.payload + + return notification + } + + createEmail (to: string) { + const videoUrl = WEBSERVER.URL + this.payload.getWatchStaticPath() + + return { + to, + subject: `Edition of your video ${this.payload.name} has finished`, + text: `Edition of your video ${this.payload.name} has finished.`, + locals: { + title: 'Video edition has finished', + action: { + text: 'View video', + url: videoUrl + } + } + } + } +} -- cgit v1.2.3