Changeset

3597:da7ec4ed6ddf

mod_http_muc_log: Hide join/part controls if they are not stored by mod_muc_mam
author Kim Alvefur <zash@zash.se>
date Thu, 16 May 2019 07:46:05 +0200
parents 3596:6e529f53b3c3
children 3598:1921ae4449b8
files mod_http_muc_log/http_muc_log.html mod_http_muc_log/mod_http_muc_log.lua
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_muc_log/http_muc_log.html	Mon May 13 00:52:35 2019 +0200
+++ b/mod_http_muc_log/http_muc_log.html	Thu May 16 07:46:05 2019 +0200
@@ -72,7 +72,7 @@
 </nav>
 
 <div>
-<form>
+{presence_available&<form>
 <label>
 <input name="p" value="h" type="checkbox"{hide_presence& checked}>
 <span>Hide joins and parts</span>
@@ -80,7 +80,7 @@
 <noscript>
 <button type="submit">Apply</button>
 </noscript>
-</form>
+</form>}
 </div>
 
 <ol class="chat-logs">{lines#
--- a/mod_http_muc_log/mod_http_muc_log.lua	Mon May 13 00:52:35 2019 +0200
+++ b/mod_http_muc_log/mod_http_muc_log.lua	Thu May 16 07:46:05 2019 +0200
@@ -132,7 +132,12 @@
 
 local lazy = module:get_option_boolean(module.name .. "_lazy_calendar", true);
 
+local presence_logged = module:get_option_boolean("muc_log_presences", false);
+
 local function hide_presence(request)
+	if not presence_logged then
+		return false;
+	end
 	if request.url.query then
 		local data = httplib.formdecode(request.url.query);
 		if data then
@@ -238,6 +243,7 @@
 		title = get_room(room):get_name();
 		jid = get_room(room).jid;
 		hide_presence = hide_presence(request);
+		presence_available = presence_logged;
 		years = years;
 		links = {
 			{ href = "../", rel = "up", text = "Room list" },
@@ -358,6 +364,7 @@
 		title = ("%s - %s"):format(get_room(room):get_name(), date);
 		jid = get_room(room).jid;
 		hide_presence = hide_presence(request);
+		presence_available = presence_logged;
 		lines = logs;
 		links = {
 			{ href = "./", rel = "up", text = "Calendar" },
@@ -390,6 +397,7 @@
 		title = module:get_option_string("name", "Prosody Chatrooms");
 		jid = module.host;
 		hide_presence = hide_presence(request);
+		presence_available = presence_logged;
 		rooms = room_list;
 	});
 end