A few fixes from comments on lemmy PR.

This commit is contained in:
Dessalines 2021-12-12 13:15:23 -05:00
parent f23488fb0b
commit 88c3b166ac
6 changed files with 25 additions and 15 deletions

View file

@ -72,7 +72,7 @@
"husky": "^7.0.4",
"import-sort-style-module": "^6.0.0",
"iso-639-1": "^2.1.10",
"lemmy-js-client": "0.15.0-rc.3",
"lemmy-js-client": "0.15.0-rc.2",
"lint-staged": "^12.1.2",
"mini-css-extract-plugin": "^2.4.5",
"node-fetch": "^2.6.1",

View file

@ -92,7 +92,7 @@ server.get("/*", async (req, res) => {
let errCode = routeData[0].error;
console.error(errCode);
if (errCode == "instance_is_private") {
return res.redirect(`/login`);
return res.redirect(`/signup`);
} else {
return res.redirect(`/404?err=${errCode}`);
}

View file

@ -108,7 +108,13 @@ export class Signup extends Component<any, State> {
}
get documentTitle(): string {
return `${i18n.t("login")} - ${this.state.site_view.site.name}`;
return `${this.titleName} - ${this.state.site_view.site.name}`;
}
get titleName(): string {
return `${i18n.t(
this.state.site_view.site.private_instance ? "apply_to_join" : "sign_up"
)}`;
}
get isLemmyMl(): boolean {
@ -132,7 +138,7 @@ export class Signup extends Component<any, State> {
registerForm() {
return (
<form onSubmit={linkEvent(this, this.handleRegisterSubmit)}>
<h5>{i18n.t("sign_up")}</h5>
<h5>{this.titleName}</h5>
<div class="form-group row">
<label class="col-sm-2 col-form-label" htmlFor="register-username">
@ -330,7 +336,7 @@ export class Signup extends Component<any, State> {
<div class="form-group row">
<div class="col-sm-10">
<button type="submit" class="btn btn-secondary">
{this.state.registerLoading ? <Spinner /> : i18n.t("sign_up")}
{this.state.registerLoading ? <Spinner /> : this.titleName}
</button>
</div>
</div>

View file

@ -1108,6 +1108,11 @@ export class Settings extends Component<any, SettingsState> {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
this.setState({
saveUserSettingsLoading: false,
changePasswordLoading: false,
deleteAccountLoading: false,
});
toast(i18n.t(msg.error), "danger");
return;
} else if (op == UserOperation.SaveUserSettings) {

View file

@ -1,13 +1,13 @@
import { Component } from "inferno";
import {
LoginResponse,
SiteView,
UserOperation,
VerifyEmail as VerifyEmailForm,
VerifyEmailResponse,
} from "lemmy-js-client";
import { Subscription } from "rxjs";
import { i18n } from "../../i18next";
import { UserService, WebSocketService } from "../../services";
import { WebSocketService } from "../../services";
import {
isBrowser,
setIsoData,
@ -85,13 +85,12 @@ export class VerifyEmail extends Component<any, State> {
this.props.history.push("/");
return;
} else if (op == UserOperation.VerifyEmail) {
let data = wsJsonToRes<LoginResponse>(msg).data;
if (data.jwt) {
let data = wsJsonToRes<VerifyEmailResponse>(msg).data;
if (data) {
toast(i18n.t("email_verified"));
this.state = this.emptyState;
this.setState(this.state);
UserService.Instance.login(data);
this.props.history.push("/");
this.props.history.push("/login");
}
}
}

View file

@ -4997,10 +4997,10 @@ lcid@^1.0.0:
dependencies:
invert-kv "^1.0.0"
lemmy-js-client@0.15.0-rc.3:
version "0.15.0-rc.3"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.15.0-rc.3.tgz#acc762981f2bbd4381857d12bf576b0d85451c4f"
integrity sha512-Yk1Y32ILc2E/eTfnjtvZBoPGwPUqokPKlouOpng7cJohFMqZUWocy8Z3yK+tx81/l0Lss9RT4HaqsRmvmEmfJw==
lemmy-js-client@0.15.0-rc.2:
version "0.15.0-rc.2"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.15.0-rc.2.tgz#e4e10edf844d90bde9915e578ced319cbd058109"
integrity sha512-qb+70MQQJ2pMNxroW+E8MNSXOrSxr3/qLO81GuAa/JT2AzbbY7mO/aXPFSrbyZWu5kn0K99alctEOC3m7mwEGw==
levn@^0.4.1:
version "0.4.1"