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

add finishedAt to browser sessions

This commit is contained in:
Kerry Archibald
2023-08-29 20:46:29 +12:00
committed by Quentin Gliech
parent 85629820fd
commit feb59344f3
3 changed files with 24 additions and 12 deletions

View File

@@ -27,6 +27,7 @@ const FRAGMENT = graphql(/* GraphQL */ `
fragment BrowserSession_session on BrowserSession {
id
createdAt
finishedAt
lastAuthentication {
id
createdAt
@@ -92,15 +93,22 @@ const BrowserSession: React.FC<Props> = ({ session, isCurrent }) => {
const sessionName = isCurrent ? "Current browser session" : "Browser session";
return (
<Session id={data.id} name={sessionName} createdAt={createdAt}>
<Button
kind="destructive"
size="sm"
onClick={onSessionEnd}
disabled={pending}
>
Sign out
</Button>
<Session
id={data.id}
name={sessionName}
createdAt={createdAt}
finishedAt={data.finishedAt}
>
{!data.finishedAt && (
<Button
kind="destructive"
size="sm"
onClick={onSessionEnd}
disabled={pending}
>
Sign out
</Button>
)}
</Session>
);
};

View File

@@ -19,7 +19,7 @@ const documents = {
types.CurrentViewerSessionQueryDocument,
"\n mutation AddEmail($userId: ID!, $email: String!) {\n addEmail(input: { userId: $userId, email: $email }) {\n status\n email {\n id\n ...UserEmail_email\n }\n }\n }\n":
types.AddEmailDocument,
"\n fragment BrowserSession_session on BrowserSession {\n id\n createdAt\n lastAuthentication {\n id\n createdAt\n }\n }\n":
"\n fragment BrowserSession_session on BrowserSession {\n id\n createdAt\n finishedAt\n lastAuthentication {\n id\n createdAt\n }\n }\n":
types.BrowserSession_SessionFragmentDoc,
"\n mutation EndBrowserSession($id: ID!) {\n endBrowserSession(input: { browserSessionId: $id }) {\n status\n browserSession {\n id\n ...BrowserSession_session\n }\n }\n }\n":
types.EndBrowserSessionDocument,
@@ -105,8 +105,8 @@ export function graphql(
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: "\n fragment BrowserSession_session on BrowserSession {\n id\n createdAt\n lastAuthentication {\n id\n createdAt\n }\n }\n",
): (typeof documents)["\n fragment BrowserSession_session on BrowserSession {\n id\n createdAt\n lastAuthentication {\n id\n createdAt\n }\n }\n"];
source: "\n fragment BrowserSession_session on BrowserSession {\n id\n createdAt\n finishedAt\n lastAuthentication {\n id\n createdAt\n }\n }\n",
): (typeof documents)["\n fragment BrowserSession_session on BrowserSession {\n id\n createdAt\n finishedAt\n lastAuthentication {\n id\n createdAt\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/

View File

@@ -940,6 +940,7 @@ export type BrowserSession_SessionFragment = {
__typename?: "BrowserSession";
id: string;
createdAt: any;
finishedAt?: any | null;
lastAuthentication?: {
__typename?: "Authentication";
id: string;
@@ -1405,6 +1406,7 @@ export const BrowserSession_SessionFragmentDoc = {
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "createdAt" } },
{ kind: "Field", name: { kind: "Name", value: "finishedAt" } },
{
kind: "Field",
name: { kind: "Name", value: "lastAuthentication" },
@@ -2024,6 +2026,7 @@ export const EndBrowserSessionDocument = {
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "createdAt" } },
{ kind: "Field", name: { kind: "Name", value: "finishedAt" } },
{
kind: "Field",
name: { kind: "Name", value: "lastAuthentication" },
@@ -2254,6 +2257,7 @@ export const BrowserSessionListDocument = {
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "createdAt" } },
{ kind: "Field", name: { kind: "Name", value: "finishedAt" } },
{
kind: "Field",
name: { kind: "Name", value: "lastAuthentication" },