Directly access namespace map instead of searching for key

This commit is contained in:
Andrew Morgan 2018-06-08 15:02:05 +01:00
parent 1aa6a9d33a
commit 63ec8a4884

View file

@ -116,9 +116,8 @@ func SetLocalAlias(
// Check that the alias does not fall within an exclusive namespace of an
// application service
for _, appservice := range cfg.Derived.ApplicationServices {
for key, namespaceMaps := range appservice.NamespaceMap {
if key == "aliases" {
for _, namespace := range namespaceMaps {
if userNamespaces, ok := appservice.NamespaceMap["users"]; ok {
for _, namespace := range userNamespaces {
if namespace.Exclusive && namespace.RegexpObject.MatchString(alias) {
return util.JSONResponse{
Code: http.StatusBadRequest,
@ -128,7 +127,6 @@ func SetLocalAlias(
}
}
}
}
var r struct {
RoomID string `json:"room_id"`