Calendar Middleware

Submitted by Stopka on

As part of my gradual ditching of Google services I moved my calendars into my own Nextcloud instance.

Nextcloud is an opensource self-hostable platform, into which you can install modules to add services you need. The goal of the project is to be a fully-fledged replacement of file storage and office suite by Google, Microsoft or Apple.

As every opensource app, even this one has few imperfections. I found one such "imperfection" very soon. Maybe it's due to my nonstandard way of organizing events with my girlfriend. We share our personal calendars to each other. The reason is obvious, it greatly simplifies planning. We don't have to constantly ask each other if the other has free time, who is visiting his parents which weekend and so on. Until here, Nextcloud works fine.

The problem starts, when one of us creates an event, which needs attendance of both of us. That means he/she creates an event in his/her calendar and invites the other into it. And especially if my girlfriend creates the event and invites me to it. I then get the invitation e-mail, I want to accept it, but nothing. Nextcloud fails with general error message. What happened?

The problem is, that when I want to accept the invitation, Nextcloud had already synchronized events from girlfriend's shared calendar. That means, in calendar database there already is one event with the same title and identifiers. Me accepting the invitation fails on that there already is such event in one of my calendars.

It's a bug in a data structure design, which enforces all events to be unique across all calendars, even those I am subscribed to in read only mode. To be clear, I had no problem in Google Calendar, because they store event in calendars separatly.

How to solve this? I reported the bug, but It has low priority and I also don't have enough spare time to study Nextcloud implementation and to try fixing it myself. But I come with a workaround.

I created a small web server, which on request a downloads girlfriend's shared calendars, modifies identifiers and titles in all events a returns this modified calendar. In Nextcloud I am not subscribed to girlfriend's calendar directly, but instead I am subscribed to this modified calendar on my new server. Events no longer collides with those in ivitations, as from Nextcloud's view they are completly different and independent events.

Solved, finally another Google service I fully moved from. The code is just several lines in Typescript, it runs in Node.js. Link to the repository is below the article.