Skip to content

Commit

Permalink
chatinfo: fix generating stub member list
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 6, 2024
1 parent fec3d93 commit 3b3b0b4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/connector/chatinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,18 @@ func (s *SlackClient) generateGroupDMName(ctx context.Context, members []string)
}

func (s *SlackClient) generateMemberList(ctx context.Context, info *slack.Channel, fetchList bool) (members bridgev2.ChatMemberList) {
if fetchList {
members.MemberMap = s.fetchChannelMembers(ctx, info.ID, s.Main.Config.ParticipantSyncCount)
}
selfUserID := slackid.MakeUserID(s.TeamID, s.UserID)
if _, hasSelf := members.MemberMap[selfUserID]; !hasSelf {
if !fetchList {
return bridgev2.ChatMemberList{
IsFull: false,
TotalMemberCount: info.NumMembers,
MemberMap: map[networkid.UserID]bridgev2.ChatMember{
selfUserID: {EventSender: s.makeEventSender(s.UserID)},
},
}
}
members.MemberMap = s.fetchChannelMembers(ctx, info.ID, s.Main.Config.ParticipantSyncCount)
if _, hasSelf := members.MemberMap[selfUserID]; !hasSelf && info.IsMember {
members.MemberMap[selfUserID] = bridgev2.ChatMember{EventSender: s.makeEventSender(s.UserID)}
}
members.IsFull = info.NumMembers > 0 && len(members.MemberMap) >= info.NumMembers
Expand Down

0 comments on commit 3b3b0b4

Please sign in to comment.