changeset 13943:758dd39c2808 13.0

mod_muc: Revert f4e16e6265e6 and invalidate avatar cache only on vcard change This should be the proper fix for this issue.
author Link Mauve <linkmauve@linkmauve.fr>
date Mon, 08 Sep 2025 15:01:50 +0200
parents f4e16e6265e6
children 5365227852ce
files plugins/muc/vcard.lib.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/vcard.lib.lua	Mon Sep 08 12:19:26 2025 +0200
+++ b/plugins/muc/vcard.lib.lua	Mon Sep 08 15:01:50 2025 +0200
@@ -10,8 +10,13 @@
 --luacheck: ignore 113/get_room_from_jid
 
 local function get_avatar_hash(room)
+	if room.avatar_hash then return room.avatar_hash; end
+
 	local room_node = jid.split(room.jid);
-	return mod_vcard.get_avatar_hash(room_node);
+	local hash = mod_vcard.get_avatar_hash(room_node);
+	room.avatar_hash = hash;
+
+	return hash;
 end
 
 local function send_avatar_hash(room, to)
@@ -62,6 +67,7 @@
 	end);
 	module:hook("vcard-updated", function (event)
 		local room = get_room_from_jid(event.stanza.attr.to);
+		room.avatar_hash = nil;
 		send_avatar_hash(room, nil);
 	end);
 end