From 073b65379a8e5f6a6cb1597b2339416d30a25686 Mon Sep 17 00:00:00 2001
From: Flo Edelmann <florian-edelmann@online.de>
Date: Wed, 1 Apr 2020 17:17:51 +0200
Subject: Fix `hide-inactive-deployments` and "Load more..." detection (#2948)

---
 source/features/hide-inactive-deployments.tsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'source/features/hide-inactive-deployments.tsx')

diff --git a/source/features/hide-inactive-deployments.tsx b/source/features/hide-inactive-deployments.tsx
index 9be27667..03d087cf 100644
--- a/source/features/hide-inactive-deployments.tsx
+++ b/source/features/hide-inactive-deployments.tsx
@@ -2,12 +2,13 @@ import select from 'select-dom';
 import features from '../libs/features';
 
 function init(): void {
-	const deployments = select.all('.TimelineItem .deployment-meta');
+	// Selects all the deployments first so that we can leave the last one on the page
+	const deployments = select.all('.js-socket-channel[data-url$="/pull_requests/events/deployed"]');
 	deployments.pop(); // Don't hide the last deployment, even if it is inactive
 
 	for (const deployment of deployments) {
-		if (select.exists('.is-inactive', deployment)) {
-			deployment.closest<HTMLElement>('.TimelineItem')!.hidden = true;
+		if (select.exists('[title="Deployment Status Label: Inactive"]', deployment)) {
+			deployment.remove();
 		}
 	}
 }
-- 
cgit v1.2.3

