changeset 4687:41ddb782320c

mod_debug_omemo: Improve no keys/devices cases
author Matthew Wild <mwild1@gmail.com>
date Mon, 13 Sep 2021 21:10:50 +0100
parents 76af816739f3
children 05725276fac0
files mod_debug_omemo/mod_debug_omemo.lua mod_debug_omemo/view.tpl.html
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_debug_omemo/mod_debug_omemo.lua	Mon Sep 13 21:47:01 2021 +0200
+++ b/mod_debug_omemo/mod_debug_omemo.lua	Mon Sep 13 21:10:50 2021 +0100
@@ -159,6 +159,8 @@
 		type = message.attr.type or "normal";
 		direction = direction;
 		encryption = is_encrypted and "encrypted" or "unencrypted";
+		has_any_keys = not message_rids:empty();
+		has_no_keys = message_rids:empty();
 	};
 
 	data.omemo = {
@@ -176,7 +178,7 @@
 			};
 		end
 	else
-		data.omemo.devices[false] = { status = "No devices", };
+		data.omemo.devices[false] = { status = "No devices have published OMEMO keys on this account" };
 	end
 
 	event.response.headers.content_type = "text/html; charset=utf-8";
--- a/mod_debug_omemo/view.tpl.html	Mon Sep 13 21:47:01 2021 +0200
+++ b/mod_debug_omemo/view.tpl.html	Mon Sep 13 21:10:50 2021 +0100
@@ -186,6 +186,8 @@
 	<p>This was an {message.encryption} {message.direction} {message.type} message. The sending device id was <tt>{omemo.sender_id}</tt>.</p>
 
 	<h4>Recipient devices</h4>
+
+	{message.has_any_keys&
 	<table class="table">
 	<tr>
 		<th>Device ID</th>
@@ -197,7 +199,9 @@
 		<td>{item.status?Unknown device} {item.prekey&<span class="badge badge-warning">Used pre-key</span>}</td>
 		<td>{item.comment?}</td>
 	</tr>}
-	</table>
+	</table>}
+
+	{message.has_no_keys&<p><strong>This message did not contain any OMEMO keys.</strong></p>}
 
 	<h3>Account status</h3>
 	<p>{user}'s account has {omemo.status} with OMEMO.</p>