From 31aa091893c0683c14160a581234c0d2058e2b0f Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 21 Oct 2020 12:34:59 +0300 Subject: [PATCH] Tasks: fix handling of categories. We were wrongly creating them as strings instead of arrays, which was causig them to be serialized wrong. Fixes #171 --- src/pim-types.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pim-types.ts b/src/pim-types.ts index 6a8739b..25b1c25 100644 --- a/src/pim-types.ts +++ b/src/pim-types.ts @@ -209,12 +209,18 @@ export class TaskType extends EventType { } set tags(tags: string[]) { - this.component.updatePropertyWithValue("categories", tags.join(",")); + const property = this.component.getFirstProperty("categories"); + if (property) { + property.setValues(tags); + } else { + const newProp = new ICAL.Property("categories", this.component); + newProp.setValues(tags); + this.component.addProperty(newProp); + } } get tags() { - const tags = this.component.getFirstPropertyValue("categories"); - return tags ? tags.split(",") : []; + return this.component.getFirstProperty("categories")?.getValues() ?? []; } set dueDate(date: ICAL.Time | undefined) {