From 53c33acaf96e2294fe299511f3db2c9894462395 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 6 Jun 2020 16:48:26 +0200 Subject: [PATCH] gluon-web-wifi-config: rename and simplify filter_active_interfaces() - Return early - Rename to has_active_interfaces(), as it returns a boolean --- .../lib/gluon/config-mode/model/admin/wifi-config.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/package/gluon-web-wifi-config/luasrc/lib/gluon/config-mode/model/admin/wifi-config.lua b/package/gluon-web-wifi-config/luasrc/lib/gluon/config-mode/model/admin/wifi-config.lua index ba662d20..d8de670a 100644 --- a/package/gluon-web-wifi-config/luasrc/lib/gluon/config-mode/model/admin/wifi-config.lua +++ b/package/gluon-web-wifi-config/luasrc/lib/gluon/config-mode/model/admin/wifi-config.lua @@ -71,14 +71,13 @@ uci:foreach('wireless', 'wifi-device', function(config) return out end - local function filter_active_interfaces(interfaces) - local out = false + local function has_active_interfaces(interfaces) for _, interface in ipairs(interfaces) do if not uci:get_bool('wireless', interface .. '_' .. radio, 'disabled') then - out = true + return true end end - return out + return false end local function vif_option(name, interfaces, msg) @@ -89,7 +88,7 @@ uci:foreach('wireless', 'wifi-device', function(config) end local o = p:option(Flag, radio .. '_' .. name .. '_enabled', msg) - o.default = filter_active_interfaces(existing_interfaces) + o.default = has_active_interfaces(existing_interfaces) function o:write(data) for _, interface in ipairs(existing_interfaces) do