Fix tags set via script saved in encoded form

This commit is contained in:
Zaid Abdulla committed 2021-11-08 13:55:30 -08:00
1 parent c9a4be0475
commit 8f827997cd
1 file changed
+6 -2
+6 -2
View File
@@ -446,14 +446,18 @@ export async function saveDevice(
if (value2 != null) {
if (!update["$addToSet"]["_tags"])
update["$addToSet"]["_tags"] = { $each: [] };
update["$addToSet"]["_tags"]["$each"].push(path.segments[1]);
update["$addToSet"]["_tags"]["$each"].push(
decodeTag(path.segments[1] as string)
);
} else {
if (!update["$pull"]["_tags"]) {
update["$pull"]["_tags"] = {
$in: [],
};
}
update["$pull"]["_tags"]["$in"].push(path.segments[1]);
update["$pull"]["_tags"]["$in"].push(
decodeTag(path.segments[1] as string)
);
}
}