From d19f0a791c0c5ec974014740726002acc2fa5572 Mon Sep 17 00:00:00 2001 From: Cameron Dawson Date: Fri, 14 Sep 2018 13:08:52 -0700 Subject: [PATCH] Bug 1490967 - Fix filtering with uppercase email address (#4032) --- tests/ui/unit/models/filter.tests.js | 13 +++++++++++++ ui/models/filter.js | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/ui/unit/models/filter.tests.js b/tests/ui/unit/models/filter.tests.js index 104ffef85..92790c914 100644 --- a/tests/ui/unit/models/filter.tests.js +++ b/tests/ui/unit/models/filter.tests.js @@ -78,5 +78,18 @@ describe('FilterModel', () => { searchStr: ['linux', 'x64', 'debug', 'build-linux64-base-toolchains/debug', '(bb)'], }); }); + + it('should preserve the case in email addresses', () => { + location.hash = '?repo=mozilla-inbound&author=VYV03354@nifty.ne.jp'; + const urlParams = FilterModel.getUrlParamsWithDefaults(); + + expect(urlParams).toEqual({ + repo: ['mozilla-inbound'], + resultStatus: ['testfailed', 'busted', 'exception', 'success', 'retry', 'usercancel', 'running', 'pending', 'runnable'], + classifiedState: ['classified', 'unclassified'], + tier: ['1', '2'], + author: ['VYV03354@nifty.ne.jp'], + }); + }); }); }); diff --git a/ui/models/filter.js b/ui/models/filter.js index b929733dc..6af1768be 100644 --- a/ui/models/filter.js +++ b/ui/models/filter.js @@ -31,7 +31,7 @@ export default class FilterModel { // Also remove usage of the 'filter-' prefix. const groupedValues = [...getAllUrlParams().entries()].reduce((acc, [urlField, urlValue]) => { const field = urlField.replace(deprecated_thFilterPrefix, ''); - const value = urlValue.toLowerCase().split(/,| /); + const value = field === 'author' ? [urlValue] : urlValue.toLowerCase().split(/,| /); return field in acc ? { ...acc, [field]: [...acc[field], ...value] } :