Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ addons:
go: 1.9
before_install:
- go get github.com/mattn/goveralls
- export DODPATH=$HOME/gopath/src/github.com/devopsdays/devopsdays-cli/sampleData
- export DODPATH=$HOME/gopath/src/github.com/devopsdays/devopsdays-cli/testdata
install:
- make install
script:
Expand Down
8 changes: 4 additions & 4 deletions event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ var qsCreateEvent = []*survey.Question{
{
Name: "twitter",
Prompt: &survey.Input{
Message: "Enter your devopsdays event twitter handle (defaults to devopsdays):",
Help: "Twitter username should not include the @ symbol",
Message: "Enter your devopsdays event twitter handle (defaults to @devopsdays):",
Help: "Twitter username can include the @ symbol or not. Examples: '@devopsdays' or 'devopsdays",
},
Validate: func(val interface{}) error {
if str, _ := val.(string); (str != "") && (helpers.ValidateField(str, "twitter") == false) {
return errors.New("Please enter a valid Twitter handle. It should not have the @ symbol.")
return errors.New("Please enter a valid Twitter handle. Spaces are not allowed.")
}
return nil
},
Expand Down Expand Up @@ -163,7 +163,7 @@ func CreateEvent(city, year string) (err error) {
Name: strings.Join([]string{strings.TrimSpace(year), "-", CityClean(city)}, ""),
Year: year,
City: city,
EventTwitter: answers.Twitter,
EventTwitter: helpers.TwitterClean(answers.Twitter),
Description: answers.Description,
GoogleAnalytics: answers.GoogleAnalytics,
StartDate: answers.StartDate,
Expand Down
2 changes: 1 addition & 1 deletion helpers/validate_field.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func ValidateField(input, field string) bool {
return true
}
case "twitter":
if (strings.ContainsAny(input, " ")) || (strings.ContainsAny(input, "@")) {
if strings.ContainsAny(input, " ") {
return false
}
return true
Expand Down
4 changes: 2 additions & 2 deletions helpers/validate_field_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ func TestValidateField(t *testing.T) {
})
Convey("When the account name is @devopsdays", func() {
twitter := "@devopsdays"
Convey("Then the response should be false", func() {
So(ValidateField(twitter, "twitter"), ShouldEqual, false)
Convey("Then the response should be true", func() {
So(ValidateField(twitter, "twitter"), ShouldEqual, true)
})
})
})
Expand Down
12 changes: 12 additions & 0 deletions sampleData/content/events/2017-ponyville/speakers/matt-stratton.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
+++
Title = "Matt Stratton"
type = "speaker"
website = "http://www.mattstratton.com"
twitter = "mattstratton"
facebook = "https://www.facebook.com/matt.stratton"
linkedin = "https://www.linkedin.com/in/mattstratton/"
github = "mattstratton"
gitlab = "mattstratton"
image = "matt-stratton.jpg"
+++

6 changes: 3 additions & 3 deletions speaker/speaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ var qsCreateSpeaker = []*survey.Question{
Name: "twitter",
Prompt: &survey.Input{
Message: "What is the speaker's Twitter? [optional]",
Help: "Twitter username should not include the @ symbol",
Help: "Twitter username can include the @ symbol or not. Examples: '@mattstratton' or 'mattstratton",
},
Validate: func(val interface{}) error {
if str, _ := val.(string); (str != "") && (helpers.ValidateField(str, "twitter") == false) {
return errors.New("Please enter a valid Twitter handle. It should not have the @ symbol.")
return errors.New("Please enter a valid Twitter handle. It should not have any spaces.")
}
return nil
},
Expand Down Expand Up @@ -180,7 +180,7 @@ func CreateSpeaker(speakerName, city, year string) (err error) {
Name: names.NameClean(answers.Name),
Title: answers.Name,
Website: answers.Website,
Twitter: answers.Twitter,
Twitter: helpers.TwitterClean(answers.Twitter),
Facebook: answers.Facebook,
Linkedin: answers.Linkedin,
Github: answers.Github,
Expand Down