diff options
author | Martin Fischer <martin@push-f.com> | 2022-07-12 14:03:15 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2022-07-12 14:03:21 +0200 |
commit | 0a6ef3c70f9e86241a2c55aab8fcf0cf18fcf2fe (patch) | |
tree | 4c464466428f6e9dcf602024610d75f66d435e76 /script.js | |
parent | 73f331a6ba321a1cb72854d92ca2724c34cb210c (diff) |
make ?author filter treat first letter as case-insensitive
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -41,7 +41,12 @@ function display(proposals) { const authorFilter = new URLSearchParams(location.search).get('author'); if (authorFilter) { - display(proposals.filter(p => p.authors && p.authors.includes(authorFilter))); + // The first letter of MediaWiki usernames is case-insensitive. + const firstChar = authorFilter.charAt(0); + const rest = authorFilter.slice(1); + const lowercase = firstChar.toLowerCase() + rest; + const uppercase = firstChar.toUpperCase() + rest; + display(proposals.filter(p => p.authors && (p.authors.includes(lowercase) || p.authors.includes(uppercase)))); } else { display(proposals); } |