Merge pull request #250 from LemmyNet/fix_user_page

Fix user page
This commit is contained in:
Dessalines 2021-04-07 12:53:00 -04:00 committed by GitHub
commit f4f836cabd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 38 additions and 21 deletions

@ -1 +1 @@
Subproject commit d9a3a1a04d57b9ef82076465f2b3c6dd5fad9430
Subproject commit 764d35d913453d1fd8eeec6007f0d94f59c8b0ee

View file

@ -212,6 +212,7 @@ export class AdminSettings extends Component<any, AdminSettingsState> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
this.context.router.history.push("/");

View file

@ -131,6 +131,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
// Only do the showing and hiding if logged in
if (UserService.Instance.localUserView) {

View file

@ -310,6 +310,7 @@ export class Communities extends Component<any, CommunitiesState> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
return;

View file

@ -314,6 +314,7 @@ export class CommunityForm extends Component<
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
this.state.loading = false;

View file

@ -432,6 +432,7 @@ export class Community extends Component<any, State> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
this.context.router.history.push("/");

View file

@ -171,6 +171,7 @@ export class CreatePost extends Component<any, CreatePostState> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
return;

View file

@ -137,6 +137,7 @@ export class CreatePrivateMessage extends Component<
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
this.state.loading = false;

View file

@ -425,6 +425,7 @@ export class Login extends Component<any, State> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
this.state = this.emptyState;

View file

@ -724,6 +724,7 @@ export class Main extends Component<any, MainState> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
return;

View file

@ -471,6 +471,7 @@ export class Modlog extends Component<any, ModlogState> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
return;

View file

@ -380,6 +380,7 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
if (msg.error == "not_logged_in") {
UserService.Instance.logout();

View file

@ -149,6 +149,7 @@ export class PasswordChange extends Component<any, State> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
this.state.loading = false;

View file

@ -437,26 +437,12 @@ export class Person extends Component<any, PersonState> {
{i18n.t("logout")}
</button>
) : (
<>
{/* TODO matrix ids aren't currently federated, so don't come back with GetPersonDetails
<a
className={`d-flex align-self-start btn btn-secondary mr-2 ${
!pv.local_user.matrix_user_id && "invisible"
}`}
rel="noopener"
href={`https://matrix.to/#/${pv.local_user.matrix_user_id}`}
>
{i18n.t("send_secure_message")}
</a>
*/}
<Link
className={"d-flex align-self-start btn btn-secondary"}
to={`/create_private_message/recipient/${pv.person.id}`}
>
{i18n.t("send_message")}
</Link>
</>
)}
</div>
{pv.person.bio && (
@ -496,6 +482,21 @@ export class Person extends Component<any, PersonState> {
);
}
// TODO this isn't used currently
// matrixButton() {
// return (
// <a
// className={`d-flex align-self-start btn btn-secondary mr-2 ${
// !pv.local_user.matrix_user_id && "invisible"
// }`}
// rel="noopener"
// href={`https://matrix.to/#/${pv.local_user.matrix_user_id}`}
// >
// {i18n.t("send_secure_message")}
// </a>
// );
// }
userSettings() {
return (
<div>
@ -1111,6 +1112,7 @@ export class Person extends Component<any, PersonState> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
if (msg.error == "couldnt_find_that_username_or_email") {
@ -1129,6 +1131,7 @@ export class Person extends Component<any, PersonState> {
// TODO this might need to get abstracted
let data = wsJsonToRes<GetPersonDetailsResponse>(msg).data;
this.state.personRes = data;
console.log(data);
this.setUserInfo();
this.state.loading = false;
this.setState(this.state);

View file

@ -606,6 +606,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
this.state.loading = false;

View file

@ -225,6 +225,7 @@ export class PrivateMessageForm extends Component<
parseMessage(msg: any) {
let op = wsUserOp(msg);
console.log(msg);
if (msg.error) {
toast(i18n.t(msg.error), "danger");
this.state.loading = false;