Skip to content

Commit

Permalink
only ensureJoined if not already joined
Browse files Browse the repository at this point in the history
  • Loading branch information
maltee1 committed Feb 15, 2024
1 parent 668134d commit d69daf6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions portal.go
Original file line number Diff line number Diff line change
Expand Up @@ -2131,21 +2131,27 @@ func (portal *Portal) SyncParticipants(ctx context.Context, source *User, info *
if member.UserID != source.SignalID && portal.MXID != "" {
userIDs[intent.UserID] = ((int)(member.Role) >> 1) * 50
}
delete(currentMembers, intent.UserID)
if portal.MXID != "" {
err := intent.EnsureJoined(ctx, portal.MXID)
if err != nil {
log.Err(err).Stringer("signal_user_id", member.UserID).Msg("Failed to ensure user is joined to portal")
if currentMembers[intent.UserID] != event.MembershipJoin {
err := intent.EnsureJoined(ctx, portal.MXID)
if err != nil {
log.Err(err).Stringer("signal_user_id", member.UserID).Msg("Failed to ensure user is joined to portal")
}
}
if puppet.customIntent == nil {
user := portal.bridge.GetUserBySignalID(member.UserID)
if user != nil {
user.ensureInvited(ctx, intent, portal.MXID, false)
userIDs[user.MXID] = ((int)(member.Role) >> 1) * 50
delete(currentMembers, user.MXID)
userIDs[user.MXID] = ((int)(member.Role) >> 1) * 50
currentMembership := currentMembers[user.MXID]
if currentMembership == event.MembershipJoin || currentMembership == event.MembershipInvite {
continue
}
user.ensureInvited(ctx, intent, portal.MXID, false)
}
}
}
delete(currentMembers, intent.UserID)
}
if portal.MXID == "" {
return userIDs
Expand Down

0 comments on commit d69daf6

Please sign in to comment.