From 8245c7b5e706f90d983dd42249d1ba2aa0718799 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 27 Feb 2017 22:30:37 +0000 Subject: [PATCH] Check for presence of API before using --- .../discourse/initializers/extend-for-solved-button.js.es6 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 b/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 index abfb1e3..6539b5f 100644 --- a/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 +++ b/assets/javascripts/discourse/initializers/extend-for-solved-button.js.es6 @@ -113,7 +113,9 @@ function initializeWithApi(api) { api.includePostAttributes('can_accept_answer', 'can_unaccept_answer', 'accepted_answer'); - api.addDiscoveryQueryParam('solved', {replace: true, refreshModel: true}); + if (api.addDiscoveryQueryParam) { + api.addDiscoveryQueryParam('solved', {replace: true, refreshModel: true}); + } api.addPostMenuButton('solved', attrs => { const canAccept = attrs.can_accept_answer;