1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

Rename 'Emails' route to 'Profile' (#1567)

* rename /account/emails route to profile

* remove support for /emails

* bad unit test for Layout

* update snapshots, fix layout test

* fix snapshots from old version of compound

* better layout test

* coverage?
This commit is contained in:
Kerry
2023-08-25 17:10:34 +12:00
committed by GitHub
parent 70e6489f17
commit c7311eea79
15 changed files with 382 additions and 23 deletions

View File

@@ -25,7 +25,7 @@ type Location = {
};
type HomeRoute = { type: "home" };
type EmailListRoute = { type: "email-list" };
type ProfileRoute = { type: "profile" };
type OAuth2ClientRoute = { type: "client"; id: string };
type OAuth2SessionList = { type: "oauth2-session-list" };
type BrowserSessionRoute = { type: "session"; id: string };
@@ -36,7 +36,7 @@ type UnknownRoute = { type: "unknown"; segments: string[] };
export type Route =
| HomeRoute
| EmailListRoute
| ProfileRoute
| OAuth2ClientRoute
| OAuth2SessionList
| BrowserSessionRoute
@@ -49,8 +49,8 @@ const routeToSegments = (route: Route): string[] => {
switch (route.type) {
case "home":
return [];
case "email-list":
return ["emails"];
case "profile":
return ["profile"];
case "verify-email":
return ["emails", route.id, "verify"];
case "client":
@@ -90,7 +90,7 @@ const segmentMatches = (
return true;
};
const segmentsToRoute = (segments: string[]): Route => {
export const segmentsToRoute = (segments: string[]): Route => {
const matches = (...pattern: PatternItem[]): boolean =>
segmentMatches(segments, ...pattern);
@@ -99,8 +99,8 @@ const segmentsToRoute = (segments: string[]): Route => {
return { type: "home" };
}
if (matches("emails")) {
return { type: "email-list" };
if (matches("profile")) {
return { type: "profile" };
}
if (matches("sessions")) {
@@ -169,7 +169,7 @@ export const routeAtom = atom(
);
const Home = lazy(() => import("./pages/Home"));
const EmailList = lazy(() => import("./pages/EmailList"));
const Profile = lazy(() => import("./pages/Profile"));
const OAuth2Client = lazy(() => import("./pages/OAuth2Client"));
const BrowserSession = lazy(() => import("./pages/BrowserSession"));
const BrowserSessionList = lazy(() => import("./pages/BrowserSessionList"));
@@ -183,8 +183,8 @@ const InnerRouter: React.FC = () => {
switch (route.type) {
case "home":
return <Home />;
case "email-list":
return <EmailList />;
case "profile":
return <Profile />;
case "oauth2-session-list":
return <OAuth2SessionList />;
case "browser-session-list":