fix: Fix user avatar update being triggered for every PubSub event
This commit is contained in:
parent
596693c206
commit
2a3449d0f2
@ -52,6 +52,14 @@ class UserAvatarManager extends XmppManagerBase {
|
|||||||
@override
|
@override
|
||||||
Future<void> onXmppEvent(XmppEvent event) async {
|
Future<void> onXmppEvent(XmppEvent event) async {
|
||||||
if (event is PubSubNotificationEvent) {
|
if (event is PubSubNotificationEvent) {
|
||||||
|
if (event.item.node != userAvatarDataXmlns) return;
|
||||||
|
|
||||||
|
if (event.item.payload.tag != 'data' ||
|
||||||
|
event.item.payload.attributes['xmlns'] != userAvatarDataXmlns) {
|
||||||
|
logger.warning('Received avatar update from ${event.from} but the payload is invalid. Ignoring...');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
getAttributes().sendEvent(
|
getAttributes().sendEvent(
|
||||||
AvatarUpdatedEvent(
|
AvatarUpdatedEvent(
|
||||||
jid: event.from,
|
jid: event.from,
|
||||||
|
Loading…
Reference in New Issue
Block a user