Skip to content

Commit

Permalink
Handle existing saved filters
Browse files Browse the repository at this point in the history
  • Loading branch information
WithoutPants committed Jan 16, 2024
1 parent 38a8cd3 commit eafd264
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion ui/v2.5/src/models/list-filter/criteria/gender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import {
GenderEnum,
} from "src/core/generated-graphql";
import { genderStrings, stringToGender } from "src/utils/gender";
import { CriterionOption, MultiStringCriterion } from "./criterion";
import {
CriterionOption,
IEncodedCriterion,
MultiStringCriterion,
} from "./criterion";

export const GenderCriterionOption = new CriterionOption({
messageID: "gender",
Expand Down Expand Up @@ -33,4 +37,18 @@ export class GenderCriterion extends MultiStringCriterion {
modifier: this.modifier,
};
}

public setFromEncodedCriterion(
encodedCriterion: IEncodedCriterion<string[]>
) {
// backwards compatibility - if the value is a string, convert it to an array
if (typeof encodedCriterion.value === "string") {
encodedCriterion = {
...encodedCriterion,
value: [encodedCriterion.value],
};
}

super.setFromEncodedCriterion(encodedCriterion);
}
}

0 comments on commit eafd264

Please sign in to comment.