Skip to content

Commit

Permalink
Filter invalid Slack users. (#26)
Browse files Browse the repository at this point in the history
Signed-off-by: viktor-kurchenko <[email protected]>
  • Loading branch information
viktor-kurchenko authored May 20, 2023
1 parent d699edc commit edf4868
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func (s *slackProvider) readUsers(ctx context.Context) error {
return err
}
for _, u := range users {
if !isValidUser(u) {
continue
}
s.slackIDs[u.ID] = struct{}{}
profile := u.Profile
if profile.Email != "" {
Expand All @@ -77,6 +80,10 @@ func (s *slackProvider) readUsers(ctx context.Context) error {
return nil
}

func isValidUser(u slack.User) bool {
return !u.Deleted && !u.IsBot && !u.IsRestricted && !u.IsUltraRestricted && !u.IsInvitedUser
}

func (s *slackProvider) readChannels(ctx context.Context) error {
var (
channels []slack.Channel
Expand Down

0 comments on commit edf4868

Please sign in to comment.