From 67c8418c31a661bda82cb3ff728a80bd8dfcb7d4 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Tue, 7 Jun 2022 17:00:11 +0100 Subject: [PATCH 1/4] fix: actually resolve the error from requests --- src/context/revoltjs/util.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/context/revoltjs/util.tsx b/src/context/revoltjs/util.tsx index 106fefe9..878cc50e 100644 --- a/src/context/revoltjs/util.tsx +++ b/src/context/revoltjs/util.tsx @@ -7,12 +7,12 @@ import { Children } from "../../types/Preact"; // eslint-disable-next-line @typescript-eslint/no-explicit-any export function takeError(error: any): string { if (error.response) { - const status = error.response.status; - if (error.response.type) { - return error.response.type; + const type = error.response.data?.type; + if (type) { + return type; } - switch (status) { + switch (error.response.status) { case 429: return "TooManyRequests"; case 401: From ee80dfd3c86138e3b58e564909c7d8ae85f28da6 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Thu, 9 Jun 2022 14:40:54 +0100 Subject: [PATCH 2/4] fix: pull `Client` into state early (should fix empty server list) --- src/context/revoltjs/RevoltClient.tsx | 2 +- src/context/revoltjs/SyncManager.tsx | 3 --- src/mobx/stores/Ordering.ts | 4 ++++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/context/revoltjs/RevoltClient.tsx b/src/context/revoltjs/RevoltClient.tsx index b4fefcce..3b4b4f5f 100644 --- a/src/context/revoltjs/RevoltClient.tsx +++ b/src/context/revoltjs/RevoltClient.tsx @@ -8,7 +8,6 @@ import { useContext, useEffect, useMemo, useState } from "preact/hooks"; import { useApplicationState } from "../../mobx/State"; import Preloader from "../../components/ui/Preloader"; - import { Children } from "../../types/Preact"; import { useIntermediate } from "../intermediate/Intermediate"; import { registerEvents } from "./events"; @@ -80,6 +79,7 @@ export default observer(({ children }: Props) => { }, [state.auth.getSession()]); useEffect(() => registerEvents(state, setStatus, client), [client]); + useEffect(() => state.registerListeners(client), [client]); if (!loaded || status === ClientStatus.LOADING) { return ; diff --git a/src/context/revoltjs/SyncManager.tsx b/src/context/revoltjs/SyncManager.tsx index 3137cad9..33cb78c6 100644 --- a/src/context/revoltjs/SyncManager.tsx +++ b/src/context/revoltjs/SyncManager.tsx @@ -22,9 +22,6 @@ export default function SyncManager() { } }, [client]); - // Keep data synced. - useEffect(() => state.registerListeners(client), [client]); - // Take data updates from Revolt. useEffect(() => { if (!client) return; diff --git a/src/mobx/stores/Ordering.ts b/src/mobx/stores/Ordering.ts index 8e2ccb11..9c53a695 100644 --- a/src/mobx/stores/Ordering.ts +++ b/src/mobx/stores/Ordering.ts @@ -73,10 +73,14 @@ export default class Ordering implements Store, Persistent, Syncable { } } + console.info("out1", out); + for (const id of known) { out.push(this.state.client!.servers.get(id)!); } + console.info("out2", out); + return out; } From 040c4367f7789125fb9ee3f9325be4b996bce884 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Thu, 9 Jun 2022 14:47:33 +0100 Subject: [PATCH 3/4] chore: clean up code --- external/lang | 2 +- src/mobx/stores/Ordering.ts | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/external/lang b/external/lang index e010e46e..1394a127 160000 --- a/external/lang +++ b/external/lang @@ -1 +1 @@ -Subproject commit e010e46ee9f226373a253c351b50ccdeea1c8b50 +Subproject commit 1394a127994951e19603be77ce2233c8133e3a81 diff --git a/src/mobx/stores/Ordering.ts b/src/mobx/stores/Ordering.ts index 9c53a695..8e2ccb11 100644 --- a/src/mobx/stores/Ordering.ts +++ b/src/mobx/stores/Ordering.ts @@ -73,14 +73,10 @@ export default class Ordering implements Store, Persistent, Syncable { } } - console.info("out1", out); - for (const id of known) { out.push(this.state.client!.servers.get(id)!); } - console.info("out2", out); - return out; } From 7544c783601901dbca3b6cbd38f24a3316248a6a Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Thu, 9 Jun 2022 14:47:53 +0100 Subject: [PATCH 4/4] chore: prepare account management buttons --- src/pages/settings/panes/Account.tsx | 41 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/pages/settings/panes/Account.tsx b/src/pages/settings/panes/Account.tsx index 65b4be55..52093d68 100644 --- a/src/pages/settings/panes/Account.tsx +++ b/src/pages/settings/panes/Account.tsx @@ -176,13 +176,9 @@ export const Account = observer(() => {
{/**/} - Two-factor authentication is currently work-in-progress, see{" "} - {` `} - - v1 milestone here + Two-factor authentication is currently in-development, see{" "} + + tracking issue here .
@@ -210,23 +206,26 @@ export const Account = observer(() => { } description={ - "Disable your account. You won't be able to access it unless you log back in." + "Disable your account. You won't be able to access it unless you contact support." } - disabled - action={}> + action="chevron" + onClick={() => { + // + }}> - - } - description={ - "Delete your account, including all of your data. (sends an email to contact@revolt.chat)" - } - hover - action="external"> - - - + } + description={ + "Your account will be queued for deletion, a confirmation email will be sent." + } + hover + action="chevron" + onClick={() => { + // + }}> + +