mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
change defer to plain function, add judgement of whether user is a normal user or an app service user before autoJoinRooms.
This commit is contained in:
parent
4f19de6730
commit
8b5b1e78fc
|
|
@ -973,8 +973,9 @@ func completeRegistration(
|
|||
}
|
||||
sessions.addCompletedRegistration(sessionID, result)
|
||||
|
||||
defer func() {
|
||||
// POST register behavior: add user to room specified in the configuration "auto_join_rooms"
|
||||
// POST register behaviour: check if the user is a normal user.
|
||||
// If the user is a normal user, add user to room specified in the configuration "auto_join_rooms".
|
||||
if accType != userapi.AccountTypeAppService && appserviceID == "" {
|
||||
for room := range cfg.AutoJoinRooms {
|
||||
err := addUserToRoom(context.Background(), clientRsApi, cfg.AutoJoinRooms[room], username,
|
||||
userutil.MakeUserID(username, cfg.Matrix.ServerName))
|
||||
|
|
@ -982,7 +983,7 @@ func completeRegistration(
|
|||
log.WithError(err).Errorf("user %s failed to auto-join room %s", username, cfg.AutoJoinRooms[room])
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusOK,
|
||||
|
|
|
|||
Loading…
Reference in a new issue