Software /
code /
prosody-modules
Diff
mod_http_admin_api/mod_http_admin_api.lua @ 4366:83370df0ce4a
mod_http_admin_api: do not report OMEMO as ok if no devices exist
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Thu, 21 Jan 2021 16:18:14 +0100 |
parent | 4365:f975a4d31f35 |
child | 4368:e0c8d866d58c |
line wrap: on
line diff
--- a/mod_http_admin_api/mod_http_admin_api.lua Thu Jan 21 16:13:29 2021 +0100 +++ b/mod_http_admin_api/mod_http_admin_api.lua Thu Jan 21 16:18:14 2021 +0100 @@ -202,6 +202,7 @@ local function get_user_omemo_info(username) local everything_valid = true; + local any_device = false; local omemo_status = {}; local omemo_devices; local pep_service = mod_pep.get_pep_service(username); @@ -213,6 +214,7 @@ if device_list then omemo_devices = {}; for device_entry in device_list:childtags("device") do + any_device = true; local device_info = {}; local device_id = tonumber(device_entry.attr.id or ""); if device_id then @@ -256,7 +258,7 @@ end end end - omemo_status.valid = everything_valid; + omemo_status.valid = everything_valid and any_device; return { status = omemo_status; devices = omemo_devices;