Merge branch 'develop/1.1.4' into chore/icons-and-settings

This commit is contained in:
Marquis Kurt 2020-10-01 13:21:19 -04:00
commit dd7b3d7b78
No known key found for this signature in database
GPG Key ID: 725636D259F5402D
2 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "hyperspace", "name": "hyperspace",
"productName": "Hyperspace Desktop", "productName": "Hyperspace Desktop",
"version": "1.1.3", "version": "1.1.4",
"description": "A beautiful, fluffy client for the fediverse", "description": "A beautiful, fluffy client for the fediverse",
"author": "Marquis Kurt <hyperspacedev@marquiskurt.net>", "author": "Marquis Kurt <hyperspacedev@marquiskurt.net>",
"repository": "https://github.com/hyperspacedev/hyperspace.git", "repository": "https://github.com/hyperspacedev/hyperspace.git",

View File

@ -285,6 +285,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
* @param user The string to update the state to * @param user The string to update the state to
*/ */
updateUserInfo(user: string) { updateUserInfo(user: string) {
this.checkForErrors(user);
this.setState({ user }); this.setState({ user });
} }
@ -415,7 +416,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
*/ */
startLogin() { startLogin() {
// Check if we have errored // Check if we have errored
let error = this.checkForErrors(); let error = this.checkForErrors(this.state.user);
// If we didn't, create the Hyperspace app to register onto that Mastodon // If we didn't, create the Hyperspace app to register onto that Mastodon
// server. // server.
@ -535,20 +536,20 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
/** /**
* Check the user input string for any possible errors * Check the user input string for any possible errors
*/ */
checkForErrors(): boolean { checkForErrors(username: string): boolean {
let userInputError = false; let userInputError = false;
let userInputErrorMessage = ""; let userInputErrorMessage = "";
// Is the user string blank? // Is the user string blank?
if (this.state.user === "") { if (username === "") {
userInputError = true; userInputError = true;
userInputErrorMessage = "Username cannot be blank."; userInputErrorMessage = "Username cannot be blank.";
this.setState({ userInputError, userInputErrorMessage }); this.setState({ userInputError, userInputErrorMessage });
return true; return true;
} else { } else {
if (this.state.user.includes("@")) { if (username.includes("@")) {
if (this.state.federates && this.state.federates === true) { if (this.state.federates && this.state.federates === true) {
let baseUrl = this.state.user.split("@")[1]; let baseUrl = username.split("@")[1];
// Is the user's domain in the disallowed list? // Is the user's domain in the disallowed list?
if (inDisallowedDomains(baseUrl)) { if (inDisallowedDomains(baseUrl)) {
@ -581,7 +582,7 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
}); });
} }
} else if ( } else if (
this.state.user.includes( username.includes(
this.state.registerBase ?? "mastodon.social" this.state.registerBase ?? "mastodon.social"
) )
) { ) {
@ -772,7 +773,6 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
onChange={event => this.updateUserInfo(event.target.value)} onChange={event => this.updateUserInfo(event.target.value)}
onKeyDown={event => this.watchUsernameField(event)} onKeyDown={event => this.watchUsernameField(event)}
error={this.state.userInputError} error={this.state.userInputError}
onBlur={() => this.checkForErrors()}
InputProps={{ InputProps={{
startAdornment: ( startAdornment: (
<InputAdornment position="start">@</InputAdornment> <InputAdornment position="start">@</InputAdornment>