Skip to content

Commit

Permalink
filter dao name with word scam and test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rashmi-278 committed Feb 21, 2024
1 parent c89d6d3 commit b5b19f6
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions daostar-website/src/components/ExplorePage/ExplorePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,36 @@ import "./ExplorePage.css";
import { InputGroup, Button } from "@blueprintjs/core";

// Prelimnary check filter, if a DAO has no name, it won't be displayed
// export const filterRegistrations = (registration, filterVal = "test") => {
// if (!registration.daoName) {
// return false;
// }
// if (filterVal !== "") {
// return registration.daoName.toLowerCase().includes(filterVal.toLowerCase());
// }
// return true;
// };

export const filterRegistrations = (registration, filterVal) => {
// Check if daoName is present
if (!registration.daoName) {
return false;
}
if (filterVal !== "") {
const daoNameLower = registration.daoName.toLowerCase();

// Convert daoName to lower case for case-insensitive comparison
const daoNameLower = registration.daoName.toLowerCase();

// List of words to filter out
const filterWords = ["scam", "test", "fuck", filterVal];

// Check if daoName contains any of the filter words
for (const filterWord of filterWords) {
if (daoNameLower.includes(filterWord)) {
return false; // Exclude if it contains a filter word
const filterWords = ["scam", "test", "fuck"];

for (const filterWord of filterWords) {
if (daoNameLower.includes(filterWord)) {
return false; // Exclude if it contains a filter word
}
}
return registration.daoName.toLowerCase().includes(filterVal.toLowerCase());
}



return true; // Include if it passes all checks
};

Expand Down

0 comments on commit b5b19f6

Please sign in to comment.