aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2022-03-24 21:57:00 +0800
committerGitHub <noreply@github.com>2022-03-24 13:57:00 +0000
commitbb31b25f1b3c7330a33b31f310aa73f99457031e (patch)
treea4e2c7d575dd9a089d08fc25cdb66d9a65b9816c
parentad818a43707feafaba89f726c925c184cc00eeb3 (diff)
fixup treat the sender_localpart as an exclusive namespace of one user (#2255)
Signed-off-by: Nick Cao <nickcao@nichi.co> Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
-rw-r--r--setup/config/config_appservice.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/setup/config/config_appservice.go b/setup/config/config_appservice.go
index 4f6553f1..3f4e1c91 100644
--- a/setup/config/config_appservice.go
+++ b/setup/config/config_appservice.go
@@ -209,13 +209,14 @@ func setupRegexps(asAPI *AppServiceAPI, derived *Derived) (err error) {
for _, appservice := range derived.ApplicationServices {
// The sender_localpart can be considered an exclusive regex for a single user, so let's do that
// to simplify the code
- var senderUserIDSlice = []string{fmt.Sprintf("@%s:%s", appservice.SenderLocalpart, asAPI.Matrix.ServerName)}
- usersSlice, found := appservice.NamespaceMap["users"]
+ users, found := appservice.NamespaceMap["users"]
if !found {
- usersSlice = []ApplicationServiceNamespace{}
- appservice.NamespaceMap["users"] = usersSlice
+ users = []ApplicationServiceNamespace{}
}
- appendExclusiveNamespaceRegexs(&senderUserIDSlice, usersSlice)
+ appservice.NamespaceMap["users"] = append(users, ApplicationServiceNamespace{
+ Exclusive: true,
+ Regex: regexp.QuoteMeta(fmt.Sprintf("@%s:%s", appservice.SenderLocalpart, asAPI.Matrix.ServerName)),
+ })
for key, namespaceSlice := range appservice.NamespaceMap {
switch key {