Fix initial value for custom flag input, update changelog

pull/6060/head
Aleksander Machniak 7 years ago
parent bae1f1d41c
commit 1fbe6cef00

@ -9,6 +9,7 @@ CHANGELOG Roundcube Webmail
- Handle remote stylesheets the same as remote images, ask the user to allow them (#5994)
- Add Message-ID to the sendmail log (#5871)
- Managesieve: Add ability to disable filter sets and other actions (#5496, #5898)
- Managesieve: Support filter action with custom IMAP flags (#6011)
- Changed defaults for smtp_user (%u), smtp_pass (%p) and smtp_port (587)
- Composer: Fix certificate validation errors by using packagist only (#5148)
- Enigma: Add button to send mail unencrypted if no key was found (#5913)

@ -1,4 +1,5 @@
- Added option managesieve_default_headers
- Support filter action with custom IMAP flags (#6011)
* version 9.0 [2017-10-02]
-----------------------------------------------------------

@ -2168,27 +2168,35 @@ class rcube_sieve_engine
'deleted' => '\\Deleted',
'draft' => '\\Draft',
);
$flags_target = (array)$action['target'];
$flags_target = (array) $action['target'];
$custom_flags = array();
$is_flag_action = preg_match('/^(set|add|remove)flag$/', $action['type']);
if ($is_flag_action) {
$custom_flags = array_filter($flags_target, function($v) use($flags) {
return !in_array_nocase($v, $flags);
});
}
$flout = '';
foreach ($flags as $fidx => $flag) {
$flout .= html::label(null, html::tag('input', array(
'type' => 'checkbox',
'name' => '_action_flags[' .$id .'][]',
'value' => $flag,
'checked' => in_array_nocase($flag, $flags_target),
'checked' => $is_flag_action && in_array_nocase($flag, $flags_target),
))
. rcube::Q($this->plugin->gettext('flag'.$fidx))) . '<br>';
}
$flags_target = array_filter($flags_target, function($v) use($flags) {
return !in_array_nocase($v, $flags);
});
$flout .= $this->list_input($id, 'action_flags', $flags_target, true,
$flout .= $this->list_input($id, 'action_flags', $custom_flags, true,
$this->error_class($id, 'action', 'flags', 'action_flags'));
$out .= html::div(array(
'id' => 'action_flags' . $id,
'style' => 'display:' . (preg_match('/^(set|add|remove)flag$/', $action['type']) ? 'inline' : 'none'),
'style' => 'display:' . ($is_flag_action ? 'inline' : 'none'),
'class' => trim('checklist ' . $this->error_class($id, 'action', 'flags', 'action_flags')),
), $flout);

Loading…
Cancel
Save