From 0840ca76a2de3a2907aa64c2cdaf3d2c69b691c2 Mon Sep 17 00:00:00 2001
From: Chocobozzz <chocobozzz@cpy.re>
Date: Thu, 5 Mar 2020 13:14:26 +0100
Subject: [PATCH] Add action hook, comments loaded (#2539)

* Adding action hook for video watch comments loaded

* Adding requested changes for PR #2539
---
 .../app/videos/+video-watch/comment/video-comments.component.ts | 1 +
 shared/models/plugins/client-hook.model.ts                      | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
index a87bc16d7..910a1761c 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
@@ -130,6 +130,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
         this.componentPagination.totalItems = res.total
 
         this.onDataSubject.next(res.data)
+        this.hooks.runAction('action:video-watch.video-threads.loaded', 'video-watch', { data: this.componentPagination })
       },
 
       err => this.notifier.error(err.message)
diff --git a/shared/models/plugins/client-hook.model.ts b/shared/models/plugins/client-hook.model.ts
index ecbe8bd3c..fc36e5771 100644
--- a/shared/models/plugins/client-hook.model.ts
+++ b/shared/models/plugins/client-hook.model.ts
@@ -65,6 +65,8 @@ export const clientActionHookObject = {
   'action:video-watch.video.loaded': true,
   // Fired when the player finished loading
   'action:video-watch.player.loaded': true,
+  // Fired when the video watch page comments(threads) are loaded and load more comments on scroll
+  'action:video-watch.video-threads.loaded': true,
 
   // Fired when the search page is being initialized
   'action:search.init': true,
-- 
2.25.1