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

Fix IP exclude rules settings #1036

Merged
merged 10 commits into from
Sep 26, 2019
Merged

Fix IP exclude rules settings #1036

merged 10 commits into from
Sep 26, 2019

Conversation

kasparsd
Copy link
Contributor

Fixes #1035.

HTML select elements with nothings selected don't get added to the POST request so the exclude conditions with empty IP rules get moved up to previous rules if they don't have an IP address rule.

Checklist

  • I have tested the changes in the local development environment (see contributing.md).

@kasparsd kasparsd self-assigned this Sep 26, 2019

$( 'tr:not(.hidden) select.select2-select', $excludeList ).each(
function() {
$( this ).select2( 'destroy' );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't recreate the select2 fields for rows with them already present.


// Ugly hack to ensure we always pass an empty value or the order of rows gets messed up.
if ( ! firstSelected.length ) {
$( this ).append( '<option selected="selected"></option>' );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the core fix -- we add a dummy option and mark it selected to ensure it gets delivered to the backend.

@kasparsd kasparsd merged commit 9915fa5 into develop Sep 26, 2019
@kasparsd kasparsd deleted the fix/1035-exclude-rules-table branch September 26, 2019 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IP addresses in exlude rules not saved correctly
1 participant