forked from MirrorHub/mautrix-whatsapp
Portal.CreateMatrixRoom: ensure the user exists
In the log some message show up with `/_matrix/client/r0/createRoom code=403 wrapped=M_FORBIDDEN: Application service has not registered this user`. This is caused by the handling of text messages coming from unknown users: mautrix-whatsapp/vendor/github.com/Rhymen/go-whatsapp/handler.go:106 mautrix-whatsapp/user.go:250 mautrix-whatsapp/portal.go:551 Hence, before creating a Matrix room, we must ensure the user for this room exists.
This commit is contained in:
parent
95c8c01450
commit
0d49bd8d08
1 changed files with 6 additions and 1 deletions
|
@ -455,6 +455,11 @@ func (portal *Portal) CreateMatrixRoom(invite []string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
intent := portal.MainIntent()
|
||||
if err := intent.EnsureRegistered(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
name := portal.Name
|
||||
topic := portal.Topic
|
||||
isPrivateChat := false
|
||||
|
@ -464,7 +469,7 @@ func (portal *Portal) CreateMatrixRoom(invite []string) error {
|
|||
isPrivateChat = true
|
||||
}
|
||||
|
||||
resp, err := portal.MainIntent().CreateRoom(&gomatrix.ReqCreateRoom{
|
||||
resp, err := intent.CreateRoom(&gomatrix.ReqCreateRoom{
|
||||
Visibility: "private",
|
||||
Name: name,
|
||||
Topic: topic,
|
||||
|
|
Loading…
Reference in a new issue