Skip to content

Commit

Permalink
feat(mail): Deletion of mail older than x. Closes #6023. Remove also …
Browse files Browse the repository at this point in the history
…template folder. Change SOGoDisableMailCleaning to SOGoEnableMailCleaning (disabled by default).
  • Loading branch information
WoodySlum committed Nov 25, 2024
1 parent ce86d14 commit ea427ea
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Documentation/SOGoInstallationGuide.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1678,8 +1678,8 @@ URL could be set to something like:
See the "EMail reminders" section in this document for more information.
|S |SOGoDisableMailCleaning
|Parameter used to disable the feature 'remove mails older than X days' introduced in 5.12. Default value is `NO`.
|S |SOGoEnableMailCleaning
|Parameter used to enable cleaning folders and mailbox (remove mail older than X days). Default value is `NO`.
|S |SOGoDisableOrganizerEventCheck
|Parameter used to disable organizer's calendar event check
Expand Down
2 changes: 1 addition & 1 deletion SoObjects/SOGo/SOGoSystemDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ NSComparisonResult languageSort(id el1, id el2, void *context);

- (NSString *)urlCreateAccount;

- (BOOL)disableMailCleaning;
- (BOOL)enableMailCleaning;

@end

Expand Down
4 changes: 2 additions & 2 deletions SoObjects/SOGo/SOGoSystemDefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -933,9 +933,9 @@ - (NSString *)urlCreateAccount
return [self stringForKey: @"SOGoURLCreateAccount"];
}

- (BOOL) disableMailCleaning
- (BOOL) enableMailCleaning
{
return [self boolForKey: @"SOGoDisableMailCleaning"];
return [self boolForKey: @"SOGoEnableMailCleaning"];
}

@end
5 changes: 3 additions & 2 deletions UI/MailerUI/UIxMailFolderActions.m
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ - (WOResponse *) cleanMailboxAction
request = [[self context] request];
jsonRequest = [[request contentAsString] objectFromJSONString];

if ([[SOGoSystemDefaults sharedSystemDefaults] disableMailCleaning])
if (![[SOGoSystemDefaults sharedSystemDefaults] enableMailCleaning])
return [self responseWithStatus: 401];

if (![self isDateStringValid: [jsonRequest objectForKey: @"date"]]) {
Expand Down Expand Up @@ -1401,7 +1401,8 @@ - (WOResponse *) cleanMailboxAction
}
folder = [account folderWithTraversal: folderName andClassName: nil];
// Disable clean for trash folder
if (![folderName isEqualToString: [account trashFolderNameInContext: [self context]]])
if (![folderName isEqualToString: [account trashFolderNameInContext: [self context]]]
&& ![folderName isEqualToString: [account templatesFolderNameInContext: [self context]]])
[self cleanFolderWithFolder: folder
withQualifier: searchQualifier
recursive: isRecursive
Expand Down
2 changes: 1 addition & 1 deletion UI/MailerUI/UIxMailMainFrame.m
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ - (BOOL) isCleanMailboxEnabled {

sd = [SOGoSystemDefaults sharedSystemDefaults];

result = ![sd disableMailCleaning];
result = [sd enableMailCleaning];

return result;
}
Expand Down

0 comments on commit ea427ea

Please sign in to comment.