Fix bug where it wasn't possible to save flag actions (#7188)

Display proper error when no flag is selected.
pull/7203/head
Aleksander Machniak 5 years ago
parent a075616fb2
commit 4114dc932d

@ -14,6 +14,7 @@ CHANGELOG Roundcube Webmail
- Enigma: Fix so using list checkbox selection does not load the key preview frame - Enigma: Fix so using list checkbox selection does not load the key preview frame
- Enigma: Fix generation of key pairs for identities with IDN domains (#7181) - Enigma: Fix generation of key pairs for identities with IDN domains (#7181)
- Enigma: Display IDN domains of key users and identities in UTF8 - Enigma: Display IDN domains of key users and identities in UTF8
- Managesieve: Fix bug where it wasn't possible to save flag actions (#7188)
- Markasjunk: Fix bug where marking as spam/ham didn't work on moving messages with drag-and-drop (#7137) - Markasjunk: Fix bug where marking as spam/ham didn't work on moving messages with drag-and-drop (#7137)
- Password: Make chpass-wrapper.py Python 3 compatible (#7135) - Password: Make chpass-wrapper.py Python 3 compatible (#7135)
- Elastic: Fix disappearing sidebar in mail compose after clicking Mail button - Elastic: Fix disappearing sidebar in mail compose after clicking Mail button

@ -2,6 +2,7 @@
- Replace "Filter disabled" with "Filter enabled" (#7028) - Replace "Filter disabled" with "Filter enabled" (#7028)
- Fix so modifier type select wasn't hidden after hiding modifier select on header change - Fix so modifier type select wasn't hidden after hiding modifier select on header change
- Fix filter selection after removing a first filter (#7079) - Fix filter selection after removing a first filter (#7079)
- Fix bug where it wasn't possible to save flag actions (#7188)
* version 9.3 [2019-04-21] * version 9.3 [2019-04-21]
----------------------------------------------------------- -----------------------------------------------------------

@ -1084,16 +1084,12 @@ class rcube_sieve_engine
case 'addflag': case 'addflag':
case 'setflag': case 'setflag':
case 'removeflag': case 'removeflag':
$_target = array(); $this->form['actions'][$i]['target'] = $this->strip_value($flags[$idx]);
if (empty($flags[$idx])) {
$this->errors['actions'][$i]['target'] = $this->plugin->gettext('noflagset'); if (empty($this->form['actions'][$i]['target'])) {
} $this->errors['actions'][$i]['flag'] = $this->plugin->gettext('noflagset');
else {
foreach ($flags[$idx] as $flag) {
$_target[] = $this->strip_value($flag);
}
} }
$this->form['actions'][$i]['target'] = $_target;
break; break;
case 'addheader': case 'addheader':
@ -2316,7 +2312,7 @@ class rcube_sieve_engine
} }
$flout .= $this->list_input($id, 'action_flags', $custom_flags, true, $flout .= $this->list_input($id, 'action_flags', $custom_flags, true,
$this->error_class($id, 'action', 'flags', 'action_flags')); $this->error_class($id, 'action', 'flag', 'action_flags_flag'), null, false, "action_flags_flag{$id}");
$out .= html::div(array( $out .= html::div(array(
'id' => 'action_flags' . $id, 'id' => 'action_flags' . $id,
@ -2578,7 +2574,7 @@ class rcube_sieve_engine
return $trim ? trim($str) : $str; return $trim ? trim($str) : $str;
} }
protected function error_class($id, $type, $target, $elem_prefix='') protected function error_class($id, $type, $target, $elem_prefix = '')
{ {
// TODO: tooltips // TODO: tooltips
if (($type == 'test' && ($str = $this->errors['tests'][$id][$target])) || if (($type == 'test' && ($str = $this->errors['tests'][$id][$target])) ||
@ -2610,7 +2606,7 @@ class rcube_sieve_engine
$this->rc->output->add_script($script, 'docready'); $this->rc->output->add_script($script, 'docready');
} }
protected function list_input($id, $name, $value, $enabled, $class, $size = null, $hidden = false) protected function list_input($id, $name, $value, $enabled, $class, $size = null, $hidden = false, $elem_id = null)
{ {
$value = (array) $value; $value = (array) $value;
$value = array_map(array('rcube', 'Q'), $value); $value = array_map(array('rcube', 'Q'), $value);
@ -2621,7 +2617,7 @@ class rcube_sieve_engine
'data-size' => $size, 'data-size' => $size,
'data-hidden' => $hidden ?: null, 'data-hidden' => $hidden ?: null,
'name' => '_' . $name . '[' . $id . ']', 'name' => '_' . $name . '[' . $id . ']',
'id' => $name.$id, 'id' => $elem_id ?: ($name.$id),
'disabled' => !$enabled, 'disabled' => !$enabled,
'class' => $class, 'class' => $class,
'style' => 'display:none', 'style' => 'display:none',

@ -276,3 +276,4 @@ $messages['emptyvacationbody'] = 'Body of vacation message is required!';
$messages['duplicate.conflict.err'] = 'Both header and unique identifier are not allowed.'; $messages['duplicate.conflict.err'] = 'Both header and unique identifier are not allowed.';
$messages['disabledaction'] = 'Action not permitted.'; $messages['disabledaction'] = 'Action not permitted.';
$messages['lastindexempty'] = 'Index is required when counting from end'; $messages['lastindexempty'] = 'Index is required when counting from end';
$messages['noflagset'] = 'At least one flag must be selected.';

@ -833,6 +833,7 @@ html.ms .propform {
& > .invalid-feedback { & > .invalid-feedback {
display: inline-block; display: inline-block;
line-height: 1.5;
} }
} }
} }

Loading…
Cancel
Save