From e38ebda1c54c59ac2a4f4613aced928c4e08152c Mon Sep 17 00:00:00 2001 From: Void Date: Fri, 6 Nov 2026 19:52:07 +0000 Subject: [PATCH] auth: training notice at registration only, versioned; one train line per room Login no longer shows the notice. Registration shows the ruled sentence with a plain tick, and records {noticeVersion, acceptedAt} on submit (newcomers only; a changed TRAINING_NOTICE_VERSION is a fresh acceptance). Each room carries one line above the composer. The Discord sentence and "on this server" are gone. Co-Authored-By: Claude Sonnet 5.5 --- src/app/features/room/RoomTrainingLine.tsx | 15 ++++++ src/app/features/room/RoomView.tsx | 2 + src/app/pages/auth/TrainingNotice.tsx | 44 ++++++++-------- .../pages/auth/login/PasswordLoginForm.tsx | 2 - .../auth/register/PasswordRegisterForm.tsx | 9 ++-- src/app/utils/trainingNotice.test.ts | 51 +++++++++++++++++++ src/app/utils/trainingNotice.ts | 43 ++++++++++++++++ 7 files changed, 134 insertions(+), 32 deletions(-) create mode 100644 src/app/features/room/RoomTrainingLine.tsx create mode 100644 src/app/utils/trainingNotice.test.ts create mode 100644 src/app/utils/trainingNotice.ts diff --git a/src/app/features/room/RoomTrainingLine.tsx b/src/app/features/room/RoomTrainingLine.tsx new file mode 100644 index 00000000..21877c3a --- /dev/null +++ b/src/app/features/room/RoomTrainingLine.tsx @@ -0,0 +1,15 @@ +import { Text, color, config } from 'folds'; +import React from 'react'; +import { TRAINING_NOTICE_TEXT } from '../../utils/trainingNotice'; + +// One line per room, pinned above the composer. +export function RoomTrainingLine() { + return ( + + {TRAINING_NOTICE_TEXT} + + ); +} diff --git a/src/app/features/room/RoomView.tsx b/src/app/features/room/RoomView.tsx index a4f0d7af..6e2a315a 100644 --- a/src/app/features/room/RoomView.tsx +++ b/src/app/features/room/RoomView.tsx @@ -13,6 +13,7 @@ import { RoomTimeline } from './RoomTimeline'; import { RoomViewTyping } from './RoomViewTyping'; import { RoomTombstone } from './RoomTombstone'; import { RoomInput } from './RoomInput'; +import { RoomTrainingLine } from './RoomTrainingLine'; import { RoomViewFollowing, RoomViewFollowingPlaceholder } from './RoomViewFollowing'; import { Page } from '../../components/page'; import { useKeyDown } from '../../hooks/useKeyDown'; @@ -104,6 +105,7 @@ export function RoomView({ eventId }: { eventId?: string }) {
+ {tombstoneEvent ? ( void }; + checked: boolean; + onToggle: () => void; }; -export function TrainingNotice({ acknowledge }: TrainingNoticeProps) { +// Registration only: ticking it is the newcomer's acceptance of the current notice version. +export function TrainingNotice({ checked, onToggle }: TrainingNoticeProps) { return ( - {TRAINING_NOTICE} - {acknowledge && ( - - - I understand and agree. - - )} + + + {TRAINING_NOTICE_TEXT} + ); } diff --git a/src/app/pages/auth/login/PasswordLoginForm.tsx b/src/app/pages/auth/login/PasswordLoginForm.tsx index 6ad6e1b0..3c8641d9 100644 --- a/src/app/pages/auth/login/PasswordLoginForm.tsx +++ b/src/app/pages/auth/login/PasswordLoginForm.tsx @@ -35,7 +35,6 @@ import { } from './loginUtil'; import { PasswordInput } from '../../../components/password-input'; import { FieldError } from '../FiledError'; -import { TrainingNotice } from '../TrainingNotice'; import { getResetPasswordPath } from '../../pathUtils'; import { stopPropagation } from '../../../utils/keyboard'; @@ -256,7 +255,6 @@ export function PasswordLoginForm({ defaultUsername, defaultEmail }: PasswordLog -