enhancement(filters): exclude tags_match_logic on export if default value (#908)

ignore tags_match_logic on export if default value
This commit is contained in:
soup 2023-05-06 16:08:12 +02:00 committed by GitHub
parent 282175c39f
commit 537bbe3394
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -391,14 +391,16 @@ const FilterItemDropdown = ({ filter, onToggle }: FilterItemDropdownProps) => {
delete completeFilter.external_webhook_expect_status;
// Remove properties with default values from the exported filter to minimize the size of the JSON string
["enabled", "priority", "smart_episode", "resolutions", "sources", "codecs", "containers"].forEach((key) => {
["enabled", "priority", "smart_episode", "resolutions", "sources", "codecs", "containers", "tags_match_logic", "except_tags_match_logic"].forEach((key) => {
const value = completeFilter[key as keyof CompleteFilterType];
if (["enabled", "priority", "smart_episode"].includes(key) && (value === false || value === 0)) {
delete completeFilter[key as keyof CompleteFilterType];
} else if (["resolutions", "sources", "codecs", "containers"].includes(key) && Array.isArray(value) && value.length === 0) {
delete completeFilter[key as keyof CompleteFilterType];
} else if (["tags_match_logic", "except_tags_match_logic"].includes(key) && value === "ANY") {
delete completeFilter[key as keyof CompleteFilterType];
}
});
});
// Create a JSON string from the filter data, including a name and version
const json = JSON.stringify(