From d43fa4d5849831c65c91c3da9f9ddd77924d48b6 Mon Sep 17 00:00:00 2001
From: Robin Ward <robin.ward@gmail.com>
Date: Wed, 11 Oct 2017 14:49:38 -0400
Subject: [PATCH] Extension points for topic list on discovery page

---
 .../discourse/controllers/discovery/topics.js.es6         | 3 +++
 .../javascripts/discourse/templates/discovery/topics.hbs  | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6
index e955208acc2..78413247b04 100644
--- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6
+++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6
@@ -25,6 +25,9 @@ const controllerOpts = {
     this.setProperties({ order: "default", ascending: false });
   },
 
+  // Overwrite this to perform client side filtering of topics, if desired
+  filteredTopics: Ember.computed.alias('model.topics'),
+
   actions: {
 
     changeSort(sortBy) {
diff --git a/app/assets/javascripts/discourse/templates/discovery/topics.hbs b/app/assets/javascripts/discourse/templates/discovery/topics.hbs
index 372a77a03aa..37d4ffe2410 100644
--- a/app/assets/javascripts/discourse/templates/discovery/topics.hbs
+++ b/app/assets/javascripts/discourse/templates/discovery/topics.hbs
@@ -32,6 +32,12 @@
   {{/if}}
 
   {{#if hasTopics}}
+
+    {{plugin-outlet
+      name="discovery-before-topic-list"
+      tagName=""
+      args=(hash model=model category=category)}}
+
     {{topic-list
       highlightLastVisited=true
       top=top
@@ -48,7 +54,7 @@
       expandGloballyPinned=expandGloballyPinned
       expandAllPinned=expandAllPinned
       category=category
-      topics=model.topics}}
+      topics=filteredTopics}}
   {{/if}}
 {{/discovery-topics-list}}