summaryrefslogtreecommitdiffstats
path: root/api/slackimport.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/slackimport.go')
-rw-r--r--api/slackimport.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/api/slackimport.go b/api/slackimport.go
index 1d037a934..4e6c01dbb 100644
--- a/api/slackimport.go
+++ b/api/slackimport.go
@@ -50,6 +50,15 @@ func SlackConvertTimeStamp(ts string) int64 {
return timeStamp * 1000 // Convert to milliseconds
}
+func SlackConvertChannelName(channelName string) string {
+ newName := strings.Trim(channelName, "_-")
+ if len(newName) == 1 {
+ return "slack-channel-" + newName
+ }
+
+ return newName
+}
+
func SlackParseChannels(data io.Reader) []SlackChannel {
decoder := json.NewDecoder(data)
@@ -172,7 +181,7 @@ func SlackAddChannels(teamId string, slackchannels []SlackChannel, posts map[str
TeamId: teamId,
Type: model.CHANNEL_OPEN,
DisplayName: sChannel.Name,
- Name: sChannel.Name,
+ Name: SlackConvertChannelName(sChannel.Name),
Description: sChannel.Topic["value"],
}
mChannel := ImportChannel(&newChannel)