Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

managesieve: fix bug when opening exists rule #5899

Closed
wants to merge 1 commit into from
Closed

managesieve: fix bug when opening exists rule #5899

wants to merge 1 commit into from

Conversation

johndoh
Copy link
Contributor

@johndoh johndoh commented Aug 12, 2017

if you create a rule in managesieve and set the test the to exists.

For example Subject Exists. Save it. navigate away and then open that rule up again the form will load with Subject Contains.

This is a little tweak just to make it load the form with Subject Exists.

@@ -677,7 +677,7 @@ function rule_header_select(id)
dateheader.style.display = h == 'date' ? '' : 'none';

$('[value="exists"],[value="notexists"]', rule).prop('disabled', h == 'string');
if (!rule.val() || rule.val().match(/^(exists|notexists)$/))
if (!rule.val() && !rule.val().match(/^(exists|notexists)$/))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code does not make sense now. I think the point was to reset the select to 'contains' if the selected value was disabled. In such cases the rule.val() will return null and there will be a javascript error. So, I think just

if (!rule.val())
    rule.val('contains');

should be enough. Thanks for spotting this issue.

@alecpl
Copy link
Member

alecpl commented Aug 19, 2017

Fixed.

@alecpl alecpl closed this Aug 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants