mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2/matrixinvite: fix bugs in DM creation
This commit is contained in:
parent
9fd1e0f87c
commit
bae61f955f
2 changed files with 3 additions and 3 deletions
|
|
@ -226,7 +226,7 @@ func (br *Bridge) handleGhostDMInvite(ctx context.Context, evt *event.Event, sen
|
|||
log.Debug().
|
||||
Str("dm_redirected_to_id", string(resp.DMRedirectedTo)).
|
||||
Msg("Created DM was redirected to another user ID")
|
||||
_, err = invitedGhost.Intent.SendState(ctx, portal.MXID, event.StateMember, invitedGhost.Intent.GetMXID().String(), &event.Content{
|
||||
_, err = invitedGhost.Intent.SendState(ctx, evt.RoomID, event.StateMember, invitedGhost.Intent.GetMXID().String(), &event.Content{
|
||||
Parsed: &event.MemberEventContent{
|
||||
Membership: event.MembershipLeave,
|
||||
Reason: "Direct chat redirected to another internal user ID",
|
||||
|
|
@ -235,7 +235,7 @@ func (br *Bridge) handleGhostDMInvite(ctx context.Context, evt *event.Event, sen
|
|||
if err != nil {
|
||||
log.Err(err).Msg("Failed to make incorrect ghost leave new DM room")
|
||||
}
|
||||
if resp.DMRedirectedTo != SpecialValueDMRedirectedToBot {
|
||||
if resp.DMRedirectedTo == SpecialValueDMRedirectedToBot {
|
||||
overrideIntent = br.Bot
|
||||
} else if otherUserGhost, err := br.GetGhostByID(ctx, resp.DMRedirectedTo); err != nil {
|
||||
log.Err(err).Msg("Failed to get ghost of real portal other user ID")
|
||||
|
|
|
|||
|
|
@ -4885,7 +4885,7 @@ func (portal *Portal) addToUserSpaces(ctx context.Context) {
|
|||
if portal.Receiver != "" {
|
||||
login := portal.Bridge.GetCachedUserLoginByID(portal.Receiver)
|
||||
if login != nil {
|
||||
up, err := portal.Bridge.DB.UserPortal.Get(ctx, login.UserLogin, portal.PortalKey)
|
||||
up, err := portal.Bridge.DB.UserPortal.GetOrCreate(ctx, login.UserLogin, portal.PortalKey)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to get user portal to add portal to spaces")
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue