From 680ca3302c8a78989bd4f26a06313983ad124925 Mon Sep 17 00:00:00 2001 From: dadak-dom Date: Wed, 12 Jun 2024 14:22:44 -0400 Subject: [PATCH 1/3] Fix for empty region and zip code when creating Street Address --- .../analysis/buildUserData/importSearchData.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/background/analysis/buildUserData/importSearchData.js b/src/background/analysis/buildUserData/importSearchData.js index 8a7849f6..8cc0c749 100644 --- a/src/background/analysis/buildUserData/importSearchData.js +++ b/src/background/analysis/buildUserData/importSearchData.js @@ -121,7 +121,7 @@ export async function importData() { } else { for (let [t, val] of Object.entries(keywordObject)) { if (t == "keyword") { - //If the useres watchlist is not current, then update it + //If the user's watchlist is not current, then update it if (val != retJson.ip) { await saveKeyword(retJson.ip, typeEnum.ipAddress, "ip", true); await saveKeyword(locKey, permissionEnum.location, "loc", true); @@ -173,7 +173,9 @@ export async function importData() { keyword: zipRegex, keywordHash: locHash, }); - userZipArr.push(zipObj); + if (zip[0] != "") { + userZipArr.push(zipObj); + } }); locElems[typeEnum.zipCode] = userZipArr; @@ -184,7 +186,7 @@ export async function importData() { locElems[typeEnum.region] = []; const userRegion = user_store_dict[typeEnum.region]; userRegion.forEach((region) => { - if (!locElems[typeEnum.region].includes(region[0])) { + if (!locElems[typeEnum.region].includes(region[0]) && region[0] != "") { var regex = getRegion(region[0]); locElems[typeEnum.region].push( new KeywordObject({ keyword: regex, keywordHash: region[1] }) @@ -193,6 +195,8 @@ export async function importData() { }); } + // NOTE: not inputting a zip code seems to create a similar problem (many unintended false positives) + if (typeEnum.city in user_store_dict) { var cityArr = []; const userCity = user_store_dict[typeEnum.city]; From 83ddf077cbdb554c8e44155f009dfd71e8871a39 Mon Sep 17 00:00:00 2001 From: dadak-dom Date: Wed, 12 Jun 2024 14:54:28 -0400 Subject: [PATCH 2/3] remove comment --- src/background/analysis/buildUserData/importSearchData.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/background/analysis/buildUserData/importSearchData.js b/src/background/analysis/buildUserData/importSearchData.js index 8cc0c749..c19fa055 100644 --- a/src/background/analysis/buildUserData/importSearchData.js +++ b/src/background/analysis/buildUserData/importSearchData.js @@ -195,8 +195,6 @@ export async function importData() { }); } - // NOTE: not inputting a zip code seems to create a similar problem (many unintended false positives) - if (typeEnum.city in user_store_dict) { var cityArr = []; const userCity = user_store_dict[typeEnum.city]; From 6767501834d7eabc88b08bd93ed43b7ea31232bb Mon Sep 17 00:00:00 2001 From: dadak-dom Date: Thu, 13 Jun 2024 12:23:15 -0400 Subject: [PATCH 3/3] Fix for displaying only a City watchlist entry --- .../components/edit-modal/index.js | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/options/views/watchlist-view/components/edit-modal/index.js b/src/options/views/watchlist-view/components/edit-modal/index.js index a593ff88..7188ec5b 100644 --- a/src/options/views/watchlist-view/components/edit-modal/index.js +++ b/src/options/views/watchlist-view/components/edit-modal/index.js @@ -48,9 +48,15 @@ import { requestNotificationPermission } from "../../../../../libs/indexed-db/no * @param {string} obj.id * @param {function():void} obj.updateList */ -export const EditModal = ({ passKeywordType, passKeyword, edit, id, updateList }) => { +export const EditModal = ({ + passKeywordType, + passKeyword, + edit, + id, + updateList, +}) => { const dropdownRef = useRef(); - const [showDropdown, setDropdown] = useState(false); + const [showDropdown, setDropdown] = useState(false); const [keywordType, setKeywordType] = useState( edit ? passKeywordType : "Select Type" ); @@ -201,13 +207,28 @@ export const EditModal = ({ passKeywordType, passKeyword, edit, id, updateList } { let key; + let displayValue; + // Some cases to fix the formatting if the user decides to only input certain parts of a street address to the watchlist + if (address == "") { + if (region == "") { + if (zip == "") { + displayValue = `${city}`; + } else { + displayValue = `${city}, ${zip}`; + } + } else { + displayValue = `${region}, ${city} ${zip}`; + } + } else { + displayValue = `${address}, ${city}, ${region} ${zip}`; + } if (keywordType == permissionEnum.location) { key = { - [typeEnum.streetAddress]: (address == "" ? null : address), + [typeEnum.streetAddress]: address == "" ? null : address, [typeEnum.zipCode]: zip, [typeEnum.region]: region, [typeEnum.city]: city, - display: (address != "") ? `${address}, ${city}, ${region} ${zip}` : ` ${city}, ${region} ${zip}`, + display: displayValue, }; } else { key = keyword; @@ -263,4 +284,4 @@ export const EditModal = ({ passKeywordType, passKeyword, edit, id, updateList } ); -}; \ No newline at end of file +};