Overwrite parent calendar name#394
Open
moritz-schuessler wants to merge 3 commits into
Open
Conversation
jonas0b1011001
requested changes
May 20, 2024
Comment on lines
+39
to
+43
| colorId: "1", | ||
| calendarName: 'Parent Calendar Name 1' | ||
| }], | ||
| ["icsUrl2", "targetCalendar2", { | ||
| calendarName: 'Parent Calendar Name 2' |
Collaborator
There was a problem hiding this comment.
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
Collaborator
There was a problem hiding this comment.
Also need to change 2x parentCal to name at line 460++
Comment on lines
+217
to
+225
| 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); }); | ||
| } |
Collaborator
There was a problem hiding this comment.
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]);
}
});
}
Author
|
I will update and finish this PR once the new config change is merged into main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added the option to change the parent calendar name if wanted.(#366)
Additional Changes
Why