]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/notifier/notifier.ts
Add video edition finished notification
[github/Chocobozzz/PeerTube.git] / server / lib / notifier / notifier.ts
index 8b68d2e691da14544e457a3a25442da3fe34aa27..e34a82603f08001c9f69c874af7f17a11fcd1ab2 100644 (file)
@@ -12,6 +12,7 @@ import {
   AbuseStateChangeForReporter,
   AutoFollowForInstance,
   CommentMention,
+  EditionFinishedForOwner,
   FollowForInstance,
   FollowForUser,
   ImportFinishedForOwner,
@@ -53,7 +54,8 @@ class Notifier {
     abuseStateChange: [ AbuseStateChangeForReporter ],
     newAbuseMessage: [ NewAbuseMessageForReporter, NewAbuseMessageForModerators ],
     newPeertubeVersion: [ NewPeerTubeVersionForAdmins ],
-    newPluginVersion: [ NewPluginVersionForAdmins ]
+    newPluginVersion: [ NewPluginVersionForAdmins ],
+    videoEditionFinished: [ EditionFinishedForOwner ]
   }
 
   private static instance: Notifier
@@ -198,6 +200,13 @@ class Notifier {
       .catch(err => logger.error('Cannot notify on new plugin version %s.', plugin.name, { err }))
   }
 
+  notifyOfFinishedVideoEdition (video: MVideoFullLight) {
+    const models = this.notificationModels.videoEditionFinished
+
+    this.sendNotifications(models, video)
+      .catch(err => logger.error('Cannot notify on finished edition %s.', video.url, { err }))
+  }
+
   private async notify <T> (object: AbstractNotification<T>) {
     await object.prepare()