Skip to content

Commit

Permalink
Fix support for SOGoSieveFolderEncoding defaults
Browse files Browse the repository at this point in the history
Fixed the following bugs in the mail filter editor:

1. Sieve folder encoding not respecting the SOGoSieveFolderEncoding
system defaults;
2. Conditions are still displayed when rule affects all messages;
3. Missing custom mail labels to "flag with" action.
  • Loading branch information
cgx committed Nov 17, 2016
1 parent 5f70555 commit baf1d44
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 9 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -20,6 +20,7 @@ Bug fixes
- [web] fixed and improved IMAP folder subscriptions manager (#3865)
- [web] fixed Sieve script activation when vacation start date is in the future (#3885)
- [web] fixed moving a component without the proper rights (#3889)
- [web] restored Sieve folder encoding support (#3904)

3.2.1 (2016-11-02)
------------------
Expand Down
16 changes: 16 additions & 0 deletions UI/PreferencesUI/English.lproj/Localizable.strings
Expand Up @@ -319,11 +319,27 @@
"Header" = "Header";
"Body" = "Body";
"Flag the message with" = "Flag the message with";

/* Select field label of "flag message" mail filter action */
"Flag" = "Flag";

"Discard the message" = "Discard the message";
"File the message in" = "File the message in";

/* Select field label of "file message" mail filter action */
"Mailbox" = "Mailbox";

"Keep the message" = "Keep the message";
"Forward the message to" = "Forward the message to";

/* Input field label of "forward" mail filter action */
"Email" = "Email";

"Send a reject message" = "Send a reject message";

/* Input field label of "reject" mail filter action */
"Message" = "Message";

"Send a vacation message" = "Send a vacation message";
"Stop processing filter rules" = "Stop processing filter rules";
"is under" = "is under";
Expand Down
5 changes: 0 additions & 5 deletions UI/PreferencesUI/UIxFilterEditor.m
Expand Up @@ -111,9 +111,4 @@ - (NSString *) labels
return [labels jsonRepresentation];
}

- (NSString *) sieveFolderEncoding
{
return [[SOGoSystemDefaults sharedSystemDefaults] sieveFolderEncoding];
}

@end
8 changes: 8 additions & 0 deletions UI/PreferencesUI/UIxPreferences.m
Expand Up @@ -1622,6 +1622,14 @@ - (BOOL) shouldDisplayPasswordChange
userCanChangePassword];
}

//
// Used wox by template
//
- (NSString *) sieveFolderEncoding
{
return [[SOGoSystemDefaults sharedSystemDefaults] sieveFolderEncoding];
}

// - (NSString *) localeCode
// {
// // WARNING : NSLocaleCode is not defined in <Foundation/NSUserDefaults.h>
Expand Down
5 changes: 2 additions & 3 deletions UI/Templates/PreferencesUI/UIxFilterEditor.wox
Expand Up @@ -26,7 +26,6 @@
<md-dialog-content class="sg-has-form-sections">
<script type="text/javascript">
var filterId = '<var:string value="filterId"/>';
var sieveFolderEncoding = '<var:string value="sieveFolderEncoding"/>';
var mailTags = <var:string value="labels" const:escapeHTML="NO"/>;
</script>

Expand All @@ -51,7 +50,7 @@
</div>

<!-- CONDITIONS -->
<div layout="column">
<div layout="column" ng-hide="filterEditor.filter.match == 'allmessages'">
<div id="filterRules"><!-- empty --></div>
<div layout="row" layout-align="start center"
ng-repeat="rule in filterEditor.filter.rules">
Expand Down Expand Up @@ -165,7 +164,7 @@
<md-option value="flagged"><var:string label:value="Flagged"/></md-option>
<md-option value="junk"><var:string label:value="Junk"/></md-option>
<md-option value="not_junk"><var:string label:value="Not Junk"/></md-option>
<md-option ng-value="key" ng-repeat="(key, value) in labels">{{ value[0] }}</md-option>
<md-option ng-value="key" ng-repeat="(key, value) in filterEditor.labels">{{ value[0] }}</md-option>
</md-select>
</md-input-container>

Expand Down
1 change: 1 addition & 0 deletions UI/Templates/PreferencesUI/UIxPreferences.wox
Expand Up @@ -21,6 +21,7 @@
var defaultEmailAddresses = '<var:string value="defaultEmailAddresses" const:escapeHTML="NO"/>';
var forwardConstraints = <var:string value="forwardConstraints" const:escapeHTML="NO"/>;
var sieveCapabilities = <var:string value="sieveCapabilities" const:escapeHTML="NO"/>;
var sieveFolderEncoding = <var:string value="sieveFolderEncoding.doubleQuotedString"/>;
</script>

<script type="text/ng-template" id="preferences.html">
Expand Down
Expand Up @@ -12,7 +12,8 @@
var vm = this,
sieveCapabilities = $window.sieveCapabilities,
forwardEnabled = $window.forwardEnabled,
vacationEnabled = $window.vacationEnabled;
vacationEnabled = $window.vacationEnabled,
sieveFolderPathAttribute = ($window.sieveFolderEncoding == "UTF-8") ? "name" : "path";

vm.filter = filter;
vm.mailboxes = mailboxes;
Expand Down Expand Up @@ -50,6 +51,12 @@
//if (vacationEnabled)
// vm.methodLabels.vacation = l("Send a vacation message");

vm.mailboxes = _.map(mailboxes, function(mailbox) {
return { level: mailbox.level,
name: mailbox.name,
path: mailbox[sieveFolderPathAttribute] };
});

if (sieveCapabilities.indexOf("reject") > -1)
vm.methodLabels.reject = l("Send a reject message");

Expand Down

0 comments on commit baf1d44

Please sign in to comment.