Skip to content

Conversation

@NeilRashbrook
Copy link
Collaborator

Regression from 535dad4 which prevented ActiveSync from detecting any user calendars or addressbooks.

This PR restores the previous behaviour, which is:

  • All user folders, calendars and addressbooks are detected on account creation
  • Creations and renamings of user folders, calendars and addressbooks are detected on folder sync
  • User calendar and addressbook accounts can be deleted from mustang, but will reappear if renamed on the server

Additionally I removed all the remaining references to URLs which was the way that user calendars and addressbooks were detected before the server ID was added to the config JSON.

if (!isMainAddressbook) {
addressbook.name = sanitize.nonemptylabel(change.DisplayName, addressbook.name);
}
await addressbook.save();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to save the addressbook on every login?

Calendars and address books should be saved in the DB, including their name, and re-loaded on every startup. They should not need to be created, not need to be saved (unless something actually changed), and not need to be added to appGlobal.addressbooks, because it's already in there since load, long before we get there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't; this only happens whenever FolderSync tells us about an address book. However, you're right about adding to appGlobal.addressbooks; I forgot to move that line back into the if (!addressbook) block.

if (!isMainCalendar) {
calendar.name = sanitize.nonemptylabel(change.DisplayName, calendar.name);
}
calendar.url = sanitize.url(folderURL);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.url should be set. At least as long as long as they are accounts, until #778 lands.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initFromMainAccount already sets the URL.

appGlobal.calendars.add(calendar);
}
if (!isMainCalendar) {
calendar.name = sanitize.nonemptylabel(change.DisplayName, calendar.name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why set this on every login? The user will want to change this. You'd overwrite user changes this way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this doesn't happen on every login, only when ActiveSync notifies us about it.

@benbucksch
Copy link
Collaborator

benbucksch commented Dec 9, 2025

prevented ActiveSync from detecting any user calendars or addressbooks.

That's strange. I tested it and it did add address books and calendars for me.

Did you try with a new account, or an existing one? Please try with a new account.

Copy link
Collaborator Author

@NeilRashbrook NeilRashbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prevented ActiveSync from detecting any user calendars or addressbooks.

That's strange. I tested it and it did add address books and calendars for me.

Did you try with a new account, or an existing one?

Trying with an existing account is pointless because the code doesn't run in this case.

Please try with a new account.

Without the patch only one of the calendars was added. (I didn't check address books because there was only one to add.)

if (!isMainAddressbook) {
addressbook.name = sanitize.nonemptylabel(change.DisplayName, addressbook.name);
}
await addressbook.save();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't; this only happens whenever FolderSync tells us about an address book. However, you're right about adding to appGlobal.addressbooks; I forgot to move that line back into the if (!addressbook) block.

if (!isMainCalendar) {
calendar.name = sanitize.nonemptylabel(change.DisplayName, calendar.name);
}
calendar.url = sanitize.url(folderURL);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initFromMainAccount already sets the URL.

appGlobal.calendars.add(calendar);
}
if (!isMainCalendar) {
calendar.name = sanitize.nonemptylabel(change.DisplayName, calendar.name);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this doesn't happen on every login, only when ActiveSync notifies us about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants