Specify a custom vacation subject

User can now specify a custom vacation subject. For Sieve servers
implementing the variables extension, one can write ${subject} to insert
the original subject in the auto reply.

SOGoDefaultVacationSubject is a new domain defaults parameter used when
the user doesn't specify a custom subject.

Fixes #685, #1447
This commit is contained in:
Francis Lachapelle
2016-06-15 16:02:12 -04:00
parent 49ed5bb462
commit d8fc40217d
10 changed files with 91 additions and 14 deletions
@@ -36,6 +36,9 @@
/* vacation (auto-reply) */
"Enable vacation auto reply" = "Enable vacation auto reply";
"Enable custom auto reply subject" = "Enable custom auto reply subject";
"Auto reply subject" = "Auto reply subject";
"You can write ${subject} to insert the original subject" = "You can write ${subject} to insert the original subject";
"Auto reply message" = "Auto reply message";
"Email addresses (separated by commas)" = "Email addresses (separated by commas)";
"Add default email addresses" = "Add default email addresses";
+15 -3
View File
@@ -72,11 +72,11 @@ static SoProduct *preferencesProduct = nil;
- (WOResponse *) jsonDefaultsAction
{
NSMutableDictionary *values, *account;
NSMutableDictionary *values, *account, *vacation;
SOGoUserDefaults *defaults;
SOGoDomainDefaults *domainDefaults;
NSMutableArray *accounts;
NSDictionary *categoryLabels;
NSDictionary *categoryLabels, *vacationOptions;
NSDictionary *locale;
if (!preferencesProduct)
@@ -312,7 +312,7 @@ static SoProduct *preferencesProduct = nil;
values = [[[[defaults source] values] mutableCopy] autorelease];
//
// Expose additional information that must not be synchronized in the defaults
// Expose additional information that must *not* be synchronized in the defaults
//
// Expose the SOGoAppointmentSendEMailNotifications configuration parameter from the domain defaults
@@ -343,6 +343,18 @@ static SoProduct *preferencesProduct = nil;
[accounts insertObject: account atIndex: 0];
[values setObject: accounts forKey: @"AuxiliaryMailAccounts"];
// Add the domain's default vacation subject if user has not specified a custom subject
vacationOptions = [defaults vacationOptions];
if (![vacationOptions objectForKey: @"customSubject"] && [domainDefaults vacationDefaultSubject])
{
if (vacationOptions)
vacation = [NSMutableDictionary dictionaryWithDictionary: vacationOptions];
else
vacation = [NSMutableDictionary dictionary];
[vacation setObject: [domainDefaults vacationDefaultSubject] forKey: @"customSubject"];
[values setObject: vacation forKey: @"Vacation"];
}
return [self responseWithStatus: 200 andJSONRepresentation: values];
}
@@ -818,6 +818,24 @@
<div class="md-inline-form" layout="column" flex-offset="5" ng-show="app.preferences.defaults.Vacation.enabled == 1">
<div layout="row">
<md-checkbox
ng-model="app.preferences.defaults.Vacation.customSubjectEnabled"
ng-true-value="1"
ng-false-value="0"
label:aria-label="Enable custom auto reply subject">
<!-- enable auto reply subject --></md-checkbox>
<md-input-container class="md-block md-flex">
<label><var:string label:value="Auto reply subject"/></label>
<input type="text"
ng-disabled="!app.preferences.defaults.Vacation.customSubjectEnabled"
ng-model="app.preferences.defaults.Vacation.customSubject"/>
<div class="sg-hint" ng-show="app.sieveVariablesCapability">
<var:string label:value="You can write ${subject} to insert the original subject"/>
</div>
</md-input-container>
</div>
<md-input-container class="md-block md-flex">
<label><var:string label:value="Auto reply message"/></label>
<var:if condition="vacationHeader.length">
@@ -37,6 +37,7 @@
vm.timeZonesList = window.timeZonesList;
vm.timeZonesListFilter = timeZonesListFilter;
vm.timeZonesSearchText = '';
vm.sieveVariablesCapability = ($window.sieveCapabilities.indexOf('variables') >= 0);
// Fetch a flatten version of the mailboxes list of the main account (0)
// This list will be forwarded to the Sieve filter controller
@@ -16,14 +16,18 @@ md-input-container {
// Temporary fix for https://github.com/angular/material/issues/6214
min-height: 0 !important;
}
.sg-hint {
@extend .md-char-counter;
@include rtl(text-align, left, right);
}
}
md-input-container .bgroup {
display: block;
}
.bgroup b {
left-margin: -1.25em;
}
//md-input-container .bgroup {
// display: block;
//}
//.bgroup b {
// left-margin: -1.25em;
//}
md-autocomplete .sg-input-no-message [md-floating-label] {
md-input-container {