Skip to content

Commit

Permalink
#44: fix the different folder name for channels and attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed Oct 9, 2022
1 parent 8c677bd commit 143de24
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func validName(ch slack.Channel) string {
if ch.IsIM {
return ch.ID
}
return ch.NameNormalized
return ch.Name
}

// saveChannel creates a directory `name` and writes the contents of msgs. for
Expand Down
4 changes: 2 additions & 2 deletions export/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ func Test_validName(t *testing.T) {
"ID42",
},
{
"channel",
args{slack.Channel{GroupConversation: slack.GroupConversation{Conversation: slack.Conversation{IsIM: false, ID: "ID42", NameNormalized: "name"}}}},
"channel (#144)",
args{slack.Channel{GroupConversation: slack.GroupConversation{Name: "name", Conversation: slack.Conversation{IsIM: false, ID: "ID42", NameNormalized: "name_normalized"}}}},
"name",
},
}
Expand Down
4 changes: 2 additions & 2 deletions internal/app/emoji/emoji.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const (
emojiDir = "emojis" // directory where all emojis are downloaded.
)

var fetchFn = fetchEmoji

// Download saves all emojis to "emoji" subdirectory of the Output.Base directory
// or archive.
func Download(ctx context.Context, cfg config.Params, prov auth.Provider) error {
Expand Down Expand Up @@ -145,8 +147,6 @@ type result struct {
err error
}

var fetchFn = fetchEmoji

// worker is the function that runs in a separate goroutine and downloads emoji
// received from emojiC. The result of the operation is sent to resultC channel.
// fn is called for each received emoji.
Expand Down
2 changes: 1 addition & 1 deletion messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,5 @@ func (sd *Session) getChannelName(ctx context.Context, l *rate.Limiter, channelI
}); err != nil {
return "", err
}
return ci.NameNormalized, nil
return ci.Name, nil
}
4 changes: 2 additions & 2 deletions messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func TestSession_DumpAll(t *testing.T) {
}

func mockConvInfo(mc *mockClienter, channelID, wantName string) {
mc.EXPECT().GetConversationInfoContext(gomock.Any(), channelID, false).Return(&slack.Channel{GroupConversation: slack.GroupConversation{Conversation: slack.Conversation{NameNormalized: wantName}}}, nil)
mc.EXPECT().GetConversationInfoContext(gomock.Any(), channelID, false).Return(&slack.Channel{GroupConversation: slack.GroupConversation{Name: wantName, Conversation: slack.Conversation{NameNormalized: wantName + "_normalized"}}}, nil)
}

func TestConversation_String(t *testing.T) {
Expand Down Expand Up @@ -389,7 +389,7 @@ func TestSession_getChannelName(t *testing.T) {
channelID: "TESTCHAN",
},
expectFn: func(sc *mockClienter) {
sc.EXPECT().GetConversationInfoContext(gomock.Any(), "TESTCHAN", false).Return(&slack.Channel{GroupConversation: slack.GroupConversation{Conversation: slack.Conversation{NameNormalized: "unittest"}}}, nil)
sc.EXPECT().GetConversationInfoContext(gomock.Any(), "TESTCHAN", false).Return(&slack.Channel{GroupConversation: slack.GroupConversation{Name: "unittest", Conversation: slack.Conversation{NameNormalized: "unittest_normalized"}}}, nil)
},
want: "unittest",
wantErr: false,
Expand Down

0 comments on commit 143de24

Please sign in to comment.