Merge pull request 'Phone text flow: portrait floor, list markers, in-flow banner, pretend-server notice' (#35) from void/text-flow-footer into dev
All checks were successful
Rat dev preview / Build dev preview (push) Successful in 4m16s
All checks were successful
Rat dev preview / Build dev preview (push) Successful in 4m16s
This commit is contained in:
commit
dfc74c252a
16 changed files with 256 additions and 27 deletions
|
|
@ -4,7 +4,9 @@ import {
|
|||
ROOM_NOTICE_EVENT_TYPE,
|
||||
TRAINING_NOTICE_TEXT,
|
||||
parseRoomNotice,
|
||||
PREVIEW_NOTICE_TEXT,
|
||||
roomTrainingLine,
|
||||
trainingNoticeText,
|
||||
} from './trainingNotice';
|
||||
|
||||
const lineFor = (content: unknown) => roomTrainingLine(parseRoomNotice(content));
|
||||
|
|
@ -66,3 +68,23 @@ describe('training notice', () => {
|
|||
expect(lineFor({ version: 1, scope: ['train'] })).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('training notice on the pretend server', () => {
|
||||
it('states that nothing is trained instead of the real sentence', () => {
|
||||
expect(trainingNoticeText(true)).toBe(PREVIEW_NOTICE_TEXT);
|
||||
expect(PREVIEW_NOTICE_TEXT).not.toContain('may be used to train');
|
||||
expect(PREVIEW_NOTICE_TEXT.toLowerCase()).toContain('pretend');
|
||||
});
|
||||
|
||||
it('keeps the ruled sentence everywhere else', () => {
|
||||
expect(trainingNoticeText(false)).toBe(TRAINING_NOTICE_TEXT);
|
||||
expect(trainingNoticeText(undefined)).toBe(TRAINING_NOTICE_TEXT);
|
||||
});
|
||||
|
||||
it('shows the same text in a train room and at registration', () => {
|
||||
const notice = parseRoomNotice({ version: 1, scope: 'train' });
|
||||
expect(roomTrainingLine(notice, true)).toBe(trainingNoticeText(true));
|
||||
expect(roomTrainingLine(notice, false)).toBe(trainingNoticeText(false));
|
||||
expect(roomTrainingLine(parseRoomNotice({ version: 1, scope: 'show' }), true)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,6 +3,15 @@ import { StateEvent } from '../../types/matrix/room';
|
|||
export const TRAINING_NOTICE_TEXT =
|
||||
"Everything said here may be used to train GameCult's AI stewards.";
|
||||
|
||||
// The preview build runs against a pretend server where nothing is trained, so the real sentence
|
||||
// would be false there. The real wording awaits Meta's legal read (Heimdall's consent text, open).
|
||||
export const PREVIEW_NOTICE_TEXT =
|
||||
'Pretend server: nothing you type here is stored or used to train anything.';
|
||||
|
||||
/** The one sentence every first-typing surface shows: the real one, or the pretend server's. */
|
||||
export const trainingNoticeText = (previewDemo?: boolean): string =>
|
||||
previewDemo === true ? PREVIEW_NOTICE_TEXT : TRAINING_NOTICE_TEXT;
|
||||
|
||||
/**
|
||||
* Heimdall's ruling: a room's notice is a room state event, not a pinned message. Type below,
|
||||
* state_key '', content `{version, scope}`; scope exactly one of show, study or train. Heimdall's
|
||||
|
|
@ -31,5 +40,7 @@ export const parseRoomNotice = (content: unknown): RoomNotice | undefined => {
|
|||
};
|
||||
|
||||
/** The line a room shows: only a notice that says `train` in terms gets the train sentence. */
|
||||
export const roomTrainingLine = (notice: RoomNotice | undefined): string | undefined =>
|
||||
notice?.scope === 'train' ? TRAINING_NOTICE_TEXT : undefined;
|
||||
export const roomTrainingLine = (
|
||||
notice: RoomNotice | undefined,
|
||||
previewDemo?: boolean
|
||||
): string | undefined => (notice?.scope === 'train' ? trainingNoticeText(previewDemo) : undefined);
|
||||
|
|
|
|||
Loading…
Reference in a new issue