Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#1487056 closed Bugs (invalid)

Default folder protection prevents users from subscribing to default folders

Reported by: brandond Owned by:
Priority: 3 Milestone: 0.5-beta
Component: Core functionality Version: git-master
Severity: major Keywords:
Cc:

Description

There is no way for users to subscribe to default folders. If for whatever reason a default folder is unsubscribed from (via another mail client, or by editing the subscriptions file), the only way to subscribe to it again via Roundcube (using Trash as an exmaple) is:

Go into Special Folders and set another subscribed folder as Trash
Go into Folders and subscribe to the original Trash folder
Go back into Special Folders and set Trash back to the original folder.

Even setting create_default_folders doesn't seem to help, as it only creates and subscribes to folders if they don't exist; it takes no action if they exist but aren't subscribed to.

I'm not sure if Roundcube should just automatically subscribe to default folders if they exist, or if we need another setting (subscribe_default_folders perhaps) to control this behavior.

Change History (7)

comment:1 Changed 3 years ago by brandond

I take it back, enabling create_default_folders would work, but only on the user's first login. It doesn't help them if they've deleted or unsubscribed from critical folders after logging in the first time.

Would you be opposed to running create_default_folders every login, or adding a setting to do so? If users are using more than one mail client, it's fairly likely that they will at some point mess up their folders.

comment:2 Changed 3 years ago by brandond

... and now that I look at this again, I'm seeing that this is a larger issue. protect_default_folders prevents you from subscribing to or unsubscribing from not just the default_imap_folders, but also from whatever folders are selected for use as the special folders. If I have 'sent-mail' set as my Sent folder for example, it is displayed as Sent, and I can't unsubscribe from it.

create_default_folders however, only creates the literal folders listed in default_imap_folders. If I have a plugin that imports folder preferences during account creation, and change the Sent folder from 'Sent' to 'sent-mail', the Sent folder will get created and subscribed to, but not treated as a special folder.

Perhaps create_default_folders could also take into effect special folder preferences, in case some plugin has overriden them in the create_user hook? Or should my plugin be responsible for creating and subscribing to folders if they're required?

comment:3 Changed 3 years ago by brandond

The issue with making the plugin responsible for folder creation is that the default folders will still get created, which could be confusing to the user. If a plugin sets sent_folder to 'sent-mail', create_default_folders will still create 'Sent', and then the user will get confused because they have two folders that are displayed as 'Sent'.

I'm not sure that there's a perfect fix for it, other than changing create_default_folders to take the folder preferences (both default and user) into effect somehow.

comment:4 Changed 3 years ago by brandond

I may have found an easy way to fix this. rcube_imap::move_message and rcube_imap::copy_message create the destination folder if it doesn't exist - so for things like sent_folder, trash_folder, etc, the folder is auto-created when needed, even if create_default_folders is disabled. This explains why my affected users report that their Trash folder contains deleted items after they go through the steps to subscribe to it.

Can I suggest that in addition to creating the destination folder when moving/copying messages, we also subscribe to it?

comment:5 Changed 3 years ago by brandond

Well, I guess I should have dug further - the folders are indeed subscribed to when they're created. I'll have to do some additional diagnosis to figure out how these users were ending up without a subscription. In the mean time, I'll probably write a simple plugin to check for subscriptions to special folders during login.

comment:6 Changed 3 years ago by thomasb

  • Resolution set to invalid
  • Status changed from new to closed

Now I'm totally confused from all your writing here. You can set protect_default_folders to false in order to solve the initial issue.

About the creation of default folders and plugins, please create a new ticket with a clear description of the problem with steps to reproduce.

comment:7 Changed 3 years ago by brandond

Yeah that's fine. I do have protect_default_folders set, but I was running into issues with it preventing people from *subscribing* to default folders. This was caused by another plugin changing special folders to sync settings with another webmail interface that didn't properly manage subscriptions. This left users with Trash for example going into a folder they were not subscribed to.

I ended up writing a small plugin that auto-creates and auto-subscribes special folders during login, which I think is a fine solution since it's not a very common situation.

Note: See TracTickets for help on using tickets.