From bac83bc16a458141f662968b9e07d4fc1eb14a92 Mon Sep 17 00:00:00 2001 From: Josh Jeffryes Date: Thu, 11 Jan 2018 09:46:45 -0500 Subject: [PATCH 1/2] default to the server coin in search --- js/views/search/Search.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/js/views/search/Search.js b/js/views/search/Search.js index 1a85bf477..4af8dcbe2 100644 --- a/js/views/search/Search.js +++ b/js/views/search/Search.js @@ -43,7 +43,7 @@ export default class extends baseVw { 'toys', ]; - // in the future the may be more possible types + // in the future there may be more possible types this.urlType = this.usingTor ? 'torlistings' : 'listings'; this.sProvider = app.searchProviders[`default${this.torString}Provider`]; @@ -94,9 +94,14 @@ export default class extends baseVw { this.term = options.term || params.q || ''; this.sortBySelected = options.sortBySelected || params.sortBy || ''; // all parameters not specified above are assumed to be filters - this.filters = _.omit(params, ['q', 'p', 'ps', 'sortBy', 'providerQ', 'network']); - // if the nsfw filter is not set, use the value from settings - this.filters.nsfw = this.filters.nsfw || String(app.settings.get('showNsfw')); + const filters = _.omit(params, ['q', 'p', 'ps', 'sortBy', 'providerQ', 'network']); + // set an initial set of filters for the first query + // if not passed in, set the user's values for nsfw and the currency + this.filters = { + nsfw: String(app.settings.get('showNsfw')), + acceptedCurrencies: app.serverConfig.cryptoCurrency, + ...filters, + }; this.processTerm(this.term); } From b7d8974b429966364dad88e524d0b1b748fa02c5 Mon Sep 17 00:00:00 2001 From: Josh Jeffryes Date: Thu, 11 Jan 2018 19:00:08 -0500 Subject: [PATCH 2/2] Code Review --- js/views/search/Search.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/views/search/Search.js b/js/views/search/Search.js index 4af8dcbe2..fac7674b1 100644 --- a/js/views/search/Search.js +++ b/js/views/search/Search.js @@ -15,6 +15,7 @@ import Suggestions from './Suggestions'; import defaultSearchProviders from '../../data/defaultSearchProviders'; import { selectEmojis } from '../../utils'; import { getCurrentConnection } from '../../utils/serverConnect'; +import { getServerCurrency } from '../../data/cryptoCurrencies'; export default class extends baseVw { constructor(options = {}) { @@ -99,7 +100,7 @@ export default class extends baseVw { // if not passed in, set the user's values for nsfw and the currency this.filters = { nsfw: String(app.settings.get('showNsfw')), - acceptedCurrencies: app.serverConfig.cryptoCurrency, + acceptedCurrencies: getServerCurrency().code, ...filters, };