Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregor Herdmann committed May 16, 2017
1 parent 82d944d commit 0c5e862
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 33 deletions.
38 changes: 10 additions & 28 deletions app/script/view_model/AuthViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ z.ViewModel.AuthViewModel = class AuthViewModel {
z.auth.URLParameter.LOCALYTICS,
],
};

}

/**
* View model for the auth page.
*
Expand Down Expand Up @@ -177,17 +177,11 @@ z.ViewModel.AuthViewModel = class AuthViewModel {
return !this.disabled_by_animation() && (this.code_expiration_timestamp() < z.util.get_unix_timestamp());
});

this.can_resend_registration = ko.pureComputed(() => {
return !this.disabled_by_animation() && this.username().length;
});
this.can_resend_registration = ko.pureComputed(() => !this.disabled_by_animation() && this.username().length);

this.can_resend_verification = ko.pureComputed(() => {
return !this.disabled_by_animation() && this.username().length;
});
this.can_resend_verification = ko.pureComputed(() => !this.disabled_by_animation() && this.username().length);

this.can_verify_password = ko.pureComputed(() => {
return !this.disabled_by_animation() && this.password().length;
});
this.can_verify_password = ko.pureComputed(() => !this.disabled_by_animation() && this.password().length);

this.account_retry_text = ko.pureComputed(() => {
return z.localization.Localizer.get_text({
Expand Down Expand Up @@ -245,21 +239,11 @@ z.ViewModel.AuthViewModel = class AuthViewModel {
});

this.posted_mode = ko.observable(undefined);
this.posted_mode_offline = ko.pureComputed(() => {
return this.posted_mode() === z.auth.AuthView.MODE.POSTED_OFFLINE;
});
this.posted_mode_pending = ko.pureComputed(() => {
return this.posted_mode() === z.auth.AuthView.MODE.POSTED_PENDING;
});
this.posted_mode_resend = ko.pureComputed(() => {
return this.posted_mode() === z.auth.AuthView.MODE.POSTED_RESEND;
});
this.posted_mode_retry = ko.pureComputed(() => {
return this.posted_mode() === z.auth.AuthView.MODE.POSTED_RETRY;
});
this.posted_mode_verify = ko.pureComputed(() => {
return this.posted_mode() === z.auth.AuthView.MODE.POSTED_VERIFY;
});
this.posted_mode_offline = ko.pureComputed(() => this.posted_mode() === z.auth.AuthView.MODE.POSTED_OFFLINE);
this.posted_mode_pending = ko.pureComputed(() => this.posted_mode() === z.auth.AuthView.MODE.POSTED_PENDING);
this.posted_mode_resend = ko.pureComputed(() => this.posted_mode() === z.auth.AuthView.MODE.POSTED_RESEND);
this.posted_mode_retry = ko.pureComputed(() => this.posted_mode() === z.auth.AuthView.MODE.POSTED_RETRY);
this.posted_mode_verify = ko.pureComputed(() => this.posted_mode() === z.auth.AuthView.MODE.POSTED_VERIFY);

// Debugging
if (z.util.Environment.frontend.is_localhost()) {
Expand Down Expand Up @@ -500,9 +484,7 @@ z.ViewModel.AuthViewModel = class AuthViewModel {
throw error;
}
})
.then(() => {
return this.user_service.change_own_email(this.username());
})
.then(() => this.user_service.change_own_email(this.username()))
.then(() => {
this.pending_server_request(false);
this._wait_for_update();
Expand Down
1 change: 0 additions & 1 deletion app/script/view_model/GiphyViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ z.ViewModel.GiphyViewModel = class GiphyViewModel {
this.logger.error(`No gifs found for query: ${this.query()}`, error);
this.state(GiphyViewModel.STATE.ERROR);
});

}
}
};
5 changes: 1 addition & 4 deletions app/script/view_model/MainViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ z.ViewModel.MainViewModel = class MainViewModel {
this.main_classes = ko.pureComputed(() => {
if (this.user()) {
// deprecated - still used on input control hover
let main_css_classes = `main-accent-color-${this.user().accent_id()}`;
main_css_classes += ` ${this.user().accent_theme()}`;
main_css_classes += ' show';
return main_css_classes;
return `main-accent-color-${this.user().accent_id()} ${this.user().accent_theme()} show`;
}
});

Expand Down

0 comments on commit 0c5e862

Please sign in to comment.