Skip to content

Commit 4e3ee4c

Browse files
Tim SchultzTim Schultz
andauthored
GITC-690 allow special short twitter handles (#9927)
Co-authored-by: Tim Schultz <timschultz@MacBook-Pro.local>
1 parent eb5e3f0 commit 4e3ee4c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/assets/v2/js/grants/_new.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Vue.mixin({
7878
});
7979
});
8080
},
81+
validateTwitterHandle: (input) => input && !(/^@?[a-zA-Z0-9_]{2,15}$/).test(input),
8182
checkForm: function(e) {
8283
let vm = this;
8384

@@ -92,10 +93,10 @@ Vue.mixin({
9293
if (!vm.form.twitter_handle_1.length) {
9394
vm.$set(vm.errors, 'twitter_handle_1', 'Please enter twitter handle of your project');
9495
}
95-
if (vm.form.twitter_handle_1 && !(/^@?[a-zA-Z0-9_]{4,15}$/).test(vm.form.twitter_handle_1)) {
96+
if (this.validateTwitterHandle(vm.form.twitter_handle_1)) {
9697
vm.$set(vm.errors, 'twitter_handle_1', 'Please enter a valid twitter handle of your project e.g @humanfund');
9798
}
98-
if (vm.form.twitter_handle_2 && !(/^@?[a-zA-Z0-9_]{4,15}$/).test(vm.form.twitter_handle_2)) {
99+
if (this.validateTwitterHandle(vm.form.twitter_handle_2)) {
99100
vm.$set(vm.errors, 'twitter_handle_2', 'Please enter your twitter handle e.g @georgecostanza');
100101
}
101102

0 commit comments

Comments
 (0)