From dfa3a2a273faef59e7c4d83c032433cb1096efc8 Mon Sep 17 00:00:00 2001 From: John Regan Date: Tue, 11 Jul 2023 02:16:36 -0400 Subject: [PATCH] chat: check that a new username is different before sending out updates (#3162) --- core/chat/events.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/chat/events.go b/core/chat/events.go index 6e10b940d..309cd368a 100644 --- a/core/chat/events.go +++ b/core/chat/events.go @@ -63,6 +63,12 @@ func (s *Server) userNameChanged(eventData chatClientEvent) { savedUser := user.GetUserByToken(eventData.client.accessToken) oldName := savedUser.DisplayName + // Check that the new name is different from old. + if proposedUsername == oldName { + eventData.client.sendConnectedClientInfo() + return + } + // Save the new name if err := user.ChangeUsername(eventData.client.User.ID, proposedUsername); err != nil { log.Errorln("error changing username", err)