-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overwrite parent calendar name #394
base: master
Are you sure you want to change the base?
Overwrite parent calendar name #394
Conversation
colorId: "1", | ||
calendarName: 'Parent Calendar Name 1' | ||
}], | ||
["icsUrl2", "targetCalendar2", { | ||
calendarName: 'Parent Calendar Name 2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use proper ical property names here:
colorId -> color
calendarName -> name
https://www.rfc-editor.org/rfc/rfc5545
https://www.rfc-editor.org/rfc/rfc7986
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also need to change 2x parentCal to name at line 460++
var colorId = itm[1] && itm[1].colorId | ||
var allEvents = component.getAllSubcomponents("vevent"); | ||
if (colorId != undefined) | ||
allEvents.forEach(function(event){event.addPropertyWithValue("color", colorId);}); | ||
|
||
var calName = component.getFirstPropertyValue("x-wr-calname") || component.getFirstPropertyValue("name"); | ||
if (calName != null) | ||
allEvents.forEach(function(event){event.addPropertyWithValue("parentCal", calName); }); | ||
var calName = (itm[1] && itm[1].calendarName) || component.getFirstPropertyValue("x-wr-calname") || component.getFirstPropertyValue("name"); | ||
if (calName != null) { | ||
component.getAllSubcomponents("vevent").forEach(function(event){event.addPropertyWithValue("parentCal", calName); }); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In preparation of future changes, let's make this less 'hardcoded'.
I'd suggest
let overrides = itm[1];
let allEvents = component.getAllSubcomponents("vevent");
let calName = component.getFirstPropertyValue("x-wr-calname") || component.getFirstPropertyValue("name");
if (calName != null)
allEvents.forEach(function(event){event.addPropertyWithValue("name", calName); });
if (overrides){
Logger.log(`Applying ${Object.keys(overrides).length} override(s)`);
allEvents.forEach(function(event){
for(let overrideProp in overrides){
event.updatePropertyWithValue(overrideProp, overrides[overrideProp]);
}
});
}
I will update and finish this PR once the new config change is merged into main |
Added the option to change the parent calendar name if wanted.(#366)
Additional Changes
Why