'Send Invite' button greyed-out and inoperative if there is a trailing space after the email address

A minor bug, but one that has caused some of our users some problems. When they try to invite someone (often by copy-pasting an email address from somewhere else) the ‘Send Invite’ button is greyed out if there is a leading or trailing space, a comma, etc included with the email address.

With trailing or leading spaces in particular, the reason for not being able to click the ‘Send Invite’ button is not obvious, and is frustrating. Removing the leading/trailing space always re-enables the button and it can then be clicked.

I am presuming that the email address field is later sanitized and trailing spaces stripped anyway, before anything is done with the email address in Discourse the Rails app, but presumably this occurs after the button is clicked. Nevertheless there must be some kind of client side/Ember validation going on that is greying out the button for invalid input. This client side validation needs to strip or ignore whitespace.

Images: Left with a trailing space (same greyed-out appearance with both leading and trailing spaces) Right without trailing space:

Marcus

@techAPJ it would be smart to strip leading/trailing spaces before validation (and of course submit those stripped versions to the server too.)

6 Likes

Okay, done! :sunny:

https://github.com/discourse/discourse/pull/3479

3 Likes