From c52f2126ae292b13bce14e072116f5ada62fdd9c Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Tue, 10 Jan 2023 22:32:52 +0100 Subject: [PATCH] Remove dead, untested code from userIDIsWithinApplicationServiceNamespace --- internal/validate.go | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/internal/validate.go b/internal/validate.go index 12a83913d0..9829d46a82 100644 --- a/internal/validate.go +++ b/internal/validate.go @@ -139,33 +139,18 @@ func userIDIsWithinApplicationServiceNamespace( return false } - if appservice != nil { - if appservice.SenderLocalpart == local { - return true - } - - // Loop through given application service's namespaces and see if any match - for _, namespace := range appservice.NamespaceMap["users"] { - // AS namespaces are checked for validity in config - if namespace.RegexpObject.MatchString(userID) { - return true - } - } - return false + if appservice.SenderLocalpart == local { + return true } - // Loop through all known application service's namespaces and see if any match - for _, knownAppService := range cfg.Derived.ApplicationServices { - if knownAppService.SenderLocalpart == local { + // Loop through given application service's namespaces and see if any match + for _, namespace := range appservice.NamespaceMap["users"] { + // AS namespaces are checked for validity in config + if namespace.RegexpObject.MatchString(userID) { return true } - for _, namespace := range knownAppService.NamespaceMap["users"] { - // AS namespaces are checked for validity in config - if namespace.RegexpObject.MatchString(userID) { - return true - } - } } + return false }