mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 13:53:09 -06:00
Tweaks
This commit is contained in:
parent
bd2e9b6211
commit
bc8ef40f05
|
|
@ -373,23 +373,21 @@ func createRoom(
|
|||
// If this is a direct message then we should invite the participants.
|
||||
if len(r.Invite) > 0 {
|
||||
// Build some stripped state for the invite.
|
||||
var strippedState []gomatrixserverlib.InviteV2StrippedState
|
||||
var globalStrippedState []gomatrixserverlib.InviteV2StrippedState
|
||||
for _, event := range builtEvents {
|
||||
switch event.Type() {
|
||||
case gomatrixserverlib.MRoomName:
|
||||
fallthrough
|
||||
case gomatrixserverlib.MRoomCanonicalAlias:
|
||||
fallthrough
|
||||
case "m.room.avatar": // TODO: move this to gmsl
|
||||
fallthrough
|
||||
case "m.room.encryption": // TODO: move this to gmsl
|
||||
fallthrough
|
||||
case gomatrixserverlib.MRoomMember:
|
||||
fallthrough
|
||||
case gomatrixserverlib.MRoomJoinRules:
|
||||
ev := event.Unwrap()
|
||||
strippedState = append(
|
||||
strippedState,
|
||||
ev := event.Event
|
||||
globalStrippedState = append(
|
||||
globalStrippedState,
|
||||
gomatrixserverlib.NewInviteV2StrippedState(&ev),
|
||||
)
|
||||
}
|
||||
|
|
@ -406,12 +404,16 @@ func createRoom(
|
|||
util.GetLogger(req.Context()).WithError(err).Error("buildMembershipEvent failed")
|
||||
continue
|
||||
}
|
||||
inviteStrippedState := append(
|
||||
globalStrippedState,
|
||||
gomatrixserverlib.NewInviteV2StrippedState(&inviteEvent.Event),
|
||||
)
|
||||
// Send the invite event to the roomserver.
|
||||
err = roomserverAPI.SendInvite(
|
||||
req.Context(),
|
||||
rsAPI,
|
||||
inviteEvent.Headered(roomVersion),
|
||||
strippedState, // invite room state
|
||||
inviteStrippedState, // invite room state
|
||||
cfg.Matrix.ServerName, // send as server
|
||||
nil, // transaction ID
|
||||
)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,10 @@ func (r *RoomserverInternalAPI) PerformInvite(
|
|||
var isAlreadyJoined bool
|
||||
roomNID, err := r.DB.RoomNID(ctx, roomID)
|
||||
if err == nil {
|
||||
_, isAlreadyJoined, _ = r.DB.GetMembership(ctx, roomNID, *event.StateKey())
|
||||
_, isAlreadyJoined, err = r.DB.GetMembership(ctx, roomNID, *event.StateKey())
|
||||
if err != nil {
|
||||
return fmt.Errorf("r.DB.GetMembership: %w", err)
|
||||
}
|
||||
}
|
||||
if isAlreadyJoined {
|
||||
// If the user is joined to the room then that takes precedence over this
|
||||
|
|
@ -146,7 +149,7 @@ func (r *RoomserverInternalAPI) PerformInvite(
|
|||
Kind: api.KindNew,
|
||||
Event: event,
|
||||
AuthEventIDs: event.AuthEventIDs(),
|
||||
SendAsServer: string(r.Cfg.Matrix.ServerName),
|
||||
SendAsServer: req.SendAsServer,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -455,3 +455,4 @@ Banned servers cannot backfill
|
|||
Inbound /v1/send_leave rejects leaves from other servers
|
||||
Guest users can accept invites to private rooms over federation
|
||||
AS user (not ghost) can join room without registering
|
||||
If user leaves room, remote user changes device and rejoins we see update in /sync and /keys/changes
|
||||
|
|
|
|||
Loading…
Reference in a new issue