Skip to content
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

Allow alternate calendar name to be prepended to title #366

Open
shadowjig opened this issue Sep 20, 2023 · 2 comments · May be fixed by #394
Open

Allow alternate calendar name to be prepended to title #366

shadowjig opened this issue Sep 20, 2023 · 2 comments · May be fixed by #394
Labels
enhancement New feature or request

Comments

@shadowjig
Copy link

Is your feature request related to a problem? Please describe.

Instead of prepending the Calendar name to the title of each event (enabled by addCalToTitle), allow us to enter an alternate calendar name in the sourceCalendars array.

For example:
var sourceCalendars = [ ["<some ical URL>", "Test Calendar", "11", "Alternate Calendar Name"] ];

Describe the solution you'd like

Enter a fourth option in the sourceCalendars array for a given ical URL. That fourth option would be prepended to each event that's added to the target calendar from the applicable source calendar.

Additional context

No response

@Lonestarjeepin
Copy link
Collaborator

If you use #372, it allows you to define an alternate calendar name just like you are looking for (in fact, it is required). Then you will just need to modify the existing addCalToTitle (see below - I put the sourceCalendarName at the end, but you can move it back to the beginning if you want). HOWEVER, a word of warning... #372 works quite differently than the current Master branch. Instead of grouping all source calendars with their corresponding target calendar, this code loops through each source calendar and processes it individually. I'd recommend you delete all calendars entries in your current calendars (you can replace your ics URLs with this empty calendar URL and run it - https://pastebin.com/raw/mEWyU5hV) that were created by GAS-ICS-Sync before you run this the first time. If you don't, it will create duplicate entries (it's because I had to modify the fromGAS part of the code to resolve overwrite conflicts). You can ignore the SyncDelay parts of this if they aren't important to you.

if (addCalToTitle && event.hasProperty('parentCal')){
//var calName = event.getFirstPropertyValue('parentCal');
newEvent.summary = newEvent.summary + " (" + sourceCalendarName + ")";
}

@Lonestarjeepin Lonestarjeepin added the enhancement New feature or request label Dec 13, 2023
@moritz-schuessler
Copy link

I changed to code for myself. It wasn't that much work. Rather then using the array for Optional Arguments in the settings, i would propose using an object for these optional Arguments.

["https://p24-calendars.icloud.com/holidays/us_en.ics", "US Holidays", {
    colorId: '1',
    calendarName: 'New Name'
}]

This change would allow to make future development easier and the settings will be easier to understand. I will clean up my code and make a PR. Even if it wont be used, I think that this could be done similar in a potential refactor #311.

@moritz-schuessler moritz-schuessler linked a pull request Dec 17, 2023 that will close this issue
@jonas0b1011001 jonas0b1011001 linked a pull request May 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants