diff --git a/app/assets/javascripts/discourse/helpers/topic-link.js.es6 b/app/assets/javascripts/discourse/helpers/topic-link.js.es6
index 9c2a73870..7af9bd994 100644
--- a/app/assets/javascripts/discourse/helpers/topic-link.js.es6
+++ b/app/assets/javascripts/discourse/helpers/topic-link.js.es6
@@ -1,9 +1,14 @@
import registerUnbound from 'discourse/helpers/register-unbound';
+import { runFilters } from 'discourse/lib/filter';
registerUnbound('topic-link', function(topic) {
var title = topic.get('fancyTitle');
var url = topic.linked_post_number ? topic.urlForPostNumber(topic.linked_post_number) : topic.get('lastUnreadUrl');
var extraClass = topic.get('last_read_post_number') === topic.get('highest_post_number') ? " visited" : "";
- return new Handlebars.SafeString("");
+ var string = "";
+
+ string = runFilters('topic-link', string, topic);
+
+ return new Handlebars.SafeString(string);
});
diff --git a/app/assets/javascripts/discourse/lib/filter.js.es6 b/app/assets/javascripts/discourse/lib/filter.js.es6
new file mode 100644
index 000000000..7f0537f20
--- /dev/null
+++ b/app/assets/javascripts/discourse/lib/filter.js.es6
@@ -0,0 +1,24 @@
+var filters = {};
+
+// use filter API to register a callback from a plugin
+const filter = function(name, fn) {
+ var current = filters[name] = filters[name] || [];
+ current.push(fn);
+};
+
+const runFilters = function(name, val) {
+ const current = filters[name];
+ if (current) {
+
+ var args = Array.prototype.slice.call(arguments, 1);
+
+ for(var i = 0; i < current.length; i++) {
+ val = current[i].apply(this, args);
+ }
+ }
+
+ return val;
+};
+
+export { runFilters };
+export default filter;