Firewall: Aliases - fix unexpected side-affect of 902487aecc, closes https://github.com/opnsense/core/issues/7614

It looks like the content selector to hook the tokenizer events was too wide, which started to cause issues after we added the live search.
This commit only targets the change events on the select itself prevent double execution and possible non string items to be forwarded to `tokenize2().trigger('tokenize:tokens:add',...)`
This commit is contained in:
Ad Schellevis 2024-07-14 14:55:29 +02:00
parent 073715d990
commit 4569d045cc

View File

@ -252,12 +252,12 @@
});
$(".geoip_select").selectpicker();
$(".geoip_select").change(function(){
$("select.geoip_select").change(function(){
// unlink on change event
$("#alias\\.content").unbind('tokenize:tokens:change');
// copy items from geoip fields to content field
$("#alias\\.content").tokenize2().trigger('tokenize:clear');
$(".geoip_select").each(function () {
$("select.geoip_select").each(function () {
$.each($(this).val(), function(key, item){
$("#alias\\.content").tokenize2().trigger('tokenize:tokens:add', item);
});