[MM-26390] Ensures the generated team name in sampledata is a valid one (#14901)

Этот коммит содержится в:
Miguel de la Cruz
2020-06-25 16:00:12 +02:00
коммит произвёл GitHub
родитель 89c3b3d5a7
Коммит 1ef5523b9f
2 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@@ -563,9 +563,18 @@ func createChannelMembership(channelName string, guest bool) app.UserChannelImpo
}
}
func getSampleTeamName(idx int) string {
for {
name := fmt.Sprintf("%s-%d", fake.Word(), idx)
if !model.IsReservedTeamName(name) {
return name
}
}
}
func createTeam(idx int) app.LineImportData {
displayName := fake.Word()
name := fmt.Sprintf("%s-%d", fake.Word(), idx)
name := getSampleTeamName(idx)
allowOpenInvite := rand.Intn(2) == 0
description := fake.Paragraph()