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", "husky": "^7.0.4",
"import-sort-style-module": "^6.0.0", "import-sort-style-module": "^6.0.0",
"iso-639-1": "^2.1.10", "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", "lint-staged": "^12.1.2",
"mini-css-extract-plugin": "^2.4.5", "mini-css-extract-plugin": "^2.4.5",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",

View file

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

View file

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

View file

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

View file

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

View file

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