Skip to content

Commit 5477191

Browse files
committed
skip archived channels to make behavior similar to standard api
1 parent 4983e10 commit 5477191

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/provider/api.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ func newWithXOXP(authProvider auth.ValueAuth) *ApiProvider {
108108
if err != nil {
109109
panic(err)
110110
} else {
111+
ap.authProvider = &authProvider
111112
ap.authResponse = &slack2.AuthTestResponse{
112113
URL: res.URL,
113114
Team: res.Team,
@@ -309,6 +310,7 @@ func (ap *ApiProvider) GetChannels(ctx context.Context, channelTypes []string) [
309310
if ap.authResponse.EnterpriseID == "" {
310311
chans1, nextcur, err = clientGeneric.GetConversationsContext(ctx, params)
311312
if err != nil {
313+
log.Printf("Failed to fetch channels: %v", err)
312314
break
313315
}
314316
for _, channel := range chans1 {
@@ -334,9 +336,14 @@ func (ap *ApiProvider) GetChannels(ctx context.Context, channelTypes []string) [
334336
} else {
335337
chans2, _, err = clientE.GetConversationsContext(ctx, nil)
336338
if err != nil {
339+
log.Printf("Failed to fetch channels: %v", err)
337340
break
338341
}
339342
for _, channel := range chans2 {
343+
if params.ExcludeArchived && channel.IsArchived {
344+
continue
345+
}
346+
340347
ch := mapChannel(
341348
channel.ID,
342349
channel.Name,

0 commit comments

Comments
 (0)