From 1c90b8dd76f98e1a917a94c164ba2a9f4455b9e9 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 27 Apr 2016 13:53:51 -0400 Subject: [PATCH] FIX: Search menu would sometimes forget the context --- .../javascripts/discourse/widgets/search-menu.js.es6 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/widgets/search-menu.js.es6 b/app/assets/javascripts/discourse/widgets/search-menu.js.es6 index c03f1a99e5a..e17c96e8e85 100644 --- a/app/assets/javascripts/discourse/widgets/search-menu.js.es6 +++ b/app/assets/javascripts/discourse/widgets/search-menu.js.es6 @@ -60,7 +60,7 @@ export default createWidget('search-menu', { fullSearchUrl() { const state = this.state; - const contextEnabled = this.attrs.contextEnabled; + const contextEnabled = state.contextEnabled; const ctx = contextEnabled ? this.searchContext() : null; const type = Ember.get(ctx, 'type'); @@ -84,7 +84,7 @@ export default createWidget('search-menu', { panelContents() { const { state } = this; - const contextEnabled = this.attrs.contextEnabled; + const contextEnabled = state.contextEnabled; const results = [this.attach('search-term', { value: state.term, contextEnabled }), this.attach('search-context', { contextEnabled })]; @@ -114,7 +114,9 @@ export default createWidget('search-menu', { return this._searchContext; }, - html() { + html(attrs, state) { + state.contextEnabled = attrs.contextEnabled; + return this.attach('menu-panel', { maxWidth: 500, contents: () => this.panelContents() }); },