Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 384f506

Browse files
author
Luke Barnard
committed
Allow searching by partial prefix (/w or /wo '+')
1 parent a425909 commit 384f506

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/views/login/CountryDropdown.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ for (const c of COUNTRIES) {
2626
}
2727

2828
function countryMatchesSearchQuery(query, country) {
29+
// Remove '+' if present (when searching for a prefix)
30+
if (query[0] === '+') {
31+
query = query.slice(1);
32+
}
33+
2934
if (country.name.toUpperCase().indexOf(query.toUpperCase()) == 0) return true;
3035
if (country.iso2 == query.toUpperCase()) return true;
31-
if (country.prefix == query) return true;
36+
if (country.prefix.indexOf(query) !== -1) return true;
3237
return false;
3338
}
3439

0 commit comments

Comments
 (0)