(fix) improve default vacation preferences handling

This commit is contained in:
Ludovic Marcotte
2015-12-09 14:06:07 -05:00
parent 903c4280f4
commit 9926653faa
2 changed files with 14 additions and 3 deletions
@@ -756,6 +756,7 @@
<md-input-container>
<label><var:string label:value="Email addresses (separated by commas)"/></label>
<textarea const:name="autoReplyEmailAddresses"
required="required"
const:id="autoReplyEmailAddresses"
ng-model="app.preferences.defaults.Vacation.autoReplyEmailAddresses"/>
</md-input-container>
@@ -33,11 +33,21 @@
data.Vacation.endDateEnabled = 0;
data.Vacation.endDate = new Date();
}
if (data.Vacation.autoReplyEmailAddresses)
if (data.Vacation.autoReplyEmailAddresses && data.Vacation.autoReplyEmailAddresses.length)
data.Vacation.autoReplyEmailAddresses = data.Vacation.autoReplyEmailAddresses.join(",");
} else {
else
delete data.Vacation.autoReplyEmailAddresses;
} else
data.Vacation = {};
if (!angular.isDefined(data.Vacation.autoReplyEmailAddresses) &&
angular.isDefined(window.defaultEmailAddresses))
data.Vacation.autoReplyEmailAddresses = window.defaultEmailAddresses;
if (!angular.isDefined(data.Vacation.daysBetweenResponse))
data.Vacation.daysBetweenResponse = 7;
if (!angular.isDefined(data.Vacation.endDate)) {
data.Vacation.endDateEnabled = 0;
data.Vacation.endDate = new Date();
}