mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 10:24:05 +00:00
fix(ci): resolve Journey strict checks and test contexts
Give the upload DTO an object for file-only requests, make UI error keys discoverable, and run the digest fixtures with the same ORM context as scheduled jobs.
This commit is contained in:
@@ -107,7 +107,10 @@ function buildHook(over: Record<string, unknown> = {}): Record<string, unknown>
|
||||
acceptDawarich: vi.fn(async () => {}), dismissDawarich: vi.fn(),
|
||||
// The recorded days a journey keeps (JRN-01) and the day take-over (JRN-02): none here,
|
||||
// their dialogs have suites of their own.
|
||||
recordings: { byDate: new Map(), dialog: null, open: vi.fn() },
|
||||
recordings: { byDate: new Map(), bySource: { dawarich: new Map(), gpx: new Map() }, dialog: null, open: vi.fn() },
|
||||
gpxImport: { busy: false, importDayFile: vi.fn(), removeDay: vi.fn() },
|
||||
canImportGpx: false,
|
||||
comments: { byEntry: new Map(), canModerate: false, add: vi.fn(), setHidden: vi.fn(), remove: vi.fn() },
|
||||
canTakeOverRecording: false, recordingNeedsConnection: false,
|
||||
dayImport: { open: vi.fn(), dialog: null },
|
||||
// Preparing the recorded days (JRN-03): not read here, so nothing is marked and the settings
|
||||
|
||||
@@ -14,15 +14,6 @@ import { useTranslation } from '../../i18n';
|
||||
import { GLASS } from '../sharedTrip/SharedChrome';
|
||||
import type { PublicSocialOutcome } from './journeyPublicModel';
|
||||
|
||||
const OUTCOME_KEYS: Record<Exclude<PublicSocialOutcome, 'ok'>, string> = {
|
||||
closed: 'journey.follow.closed',
|
||||
gone: 'journey.public.notFoundMessage',
|
||||
locked: 'journey.comments.locked',
|
||||
rate_limited: 'common.tooManyAttempts',
|
||||
invalid: 'journey.follow.invalid',
|
||||
failed: 'journey.follow.failed',
|
||||
};
|
||||
|
||||
/**
|
||||
* "Follow" on a shared journey (#1669): one glass pill in the hero, and a small
|
||||
* dialog that takes an address. The server answers the same for an address that
|
||||
@@ -34,6 +25,14 @@ export function JourneyPublicFollow({
|
||||
onSubscribe: (email: string, locale: string) => Promise<PublicSocialOutcome>;
|
||||
}) {
|
||||
const { t, locale } = useTranslation();
|
||||
const messages = {
|
||||
closed: t('journey.follow.closed'),
|
||||
gone: t('journey.public.notFoundMessage'),
|
||||
locked: t('journey.comments.locked'),
|
||||
rate_limited: t('common.tooManyAttempts'),
|
||||
invalid: t('journey.follow.invalid'),
|
||||
failed: t('journey.follow.failed'),
|
||||
};
|
||||
const labelId = useId();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [email, setEmail] = useState('');
|
||||
@@ -60,7 +59,7 @@ export function JourneyPublicFollow({
|
||||
const outcome = await onSubscribe(email.trim(), locale || 'en');
|
||||
setBusy(false);
|
||||
if (outcome === 'ok') setSent(true);
|
||||
else setError(t(OUTCOME_KEYS[outcome]));
|
||||
else setError(messages[outcome]);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,12 +3,6 @@ import { useState, type FormEvent, type ReactNode } from 'react';
|
||||
import { useTranslation } from '../../i18n';
|
||||
import type { PublicUnlockOutcome } from './journeyPublicModel';
|
||||
|
||||
const OUTCOME_KEYS: Record<Exclude<PublicUnlockOutcome, 'ok' | 'expired'>, string> = {
|
||||
wrong: 'journey.public.passwordWrong',
|
||||
rate_limited: 'common.tooManyAttempts',
|
||||
failed: 'journey.public.passwordFailed',
|
||||
};
|
||||
|
||||
function GateFrame({
|
||||
icon,
|
||||
title,
|
||||
@@ -41,6 +35,11 @@ export function JourneyPublicPasswordCard({
|
||||
onUnlock: (password: string) => Promise<PublicUnlockOutcome>;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const messages = {
|
||||
wrong: t('journey.public.passwordWrong'),
|
||||
rate_limited: t('common.tooManyAttempts'),
|
||||
failed: t('journey.public.passwordFailed'),
|
||||
};
|
||||
const [password, setPassword] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -53,7 +52,7 @@ export function JourneyPublicPasswordCard({
|
||||
const outcome = await onUnlock(password);
|
||||
setBusy(false);
|
||||
if (outcome === 'ok' || outcome === 'expired') return;
|
||||
setError(t(OUTCOME_KEYS[outcome]));
|
||||
setError(messages[outcome]);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user