Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

place-contrib: settle the second CI round

Maurice36c1599a0997
diff --git a/client/src/components/Admin/PlaceContribPanel.tsx b/client/src/components/Admin/PlaceContribPanel.tsx
index 00e76df7c..4f7ee256e 100644
--- a/client/src/components/Admin/PlaceContribPanel.tsx
+++ b/client/src/components/Admin/PlaceContribPanel.tsx
@@ -1,8 +1,7 @@
import type { PlaceContribField, PlaceContribState } from '@trek/shared';
-import { HeartHandshake, Undo2 } from 'lucide-react';
+import { ChevronRight, HeartHandshake, Undo2 } from 'lucide-react';
import { useState } from 'react';
import { useTranslation } from '../../i18n';
-import FoldSummary from '../../pages/admin/FoldSummary';
import type { TranslationFn } from '../../types';
import { getApiErrorMessage } from '../../utils/apiError';
import { StatusPill } from '../Settings/settingsKit';
@@ -156,11 +155,18 @@ export default function PlaceContribPanel() {
{(agreed || state.consent.decision === 'off') && (
<details className="group overflow-hidden rounded-[12px] border border-edge-faint bg-surface-card">
- <FoldSummary>
+ {/* The admin page's fold head (pages/admin/FoldSummary), which a component cannot import. */}
+ <summary className="flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2.5 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--text-primary)] [&::-webkit-details-marker]:hidden">
+ <ChevronRight
+ size={15}
+ strokeWidth={2}
+ className="flex-none text-content-faint transition-transform group-open:rotate-90"
+ aria-hidden="true"
+ />
<span className="font-medium text-content" style={fs(12.5, 'body')}>
{t('admin.contribute.log.title')}
</span>
- </FoldSummary>
+ </summary>
<div className="flex flex-col gap-3 border-t border-edge-faint p-3">
<PlaceContribLog />
<button
diff --git a/server/src/nest/place-contrib/place-contrib.job.ts b/server/src/nest/place-contrib/place-contrib.job.ts
index d21bd70f7..8563eda77 100644
--- a/server/src/nest/place-contrib/place-contrib.job.ts
+++ b/server/src/nest/place-contrib/place-contrib.job.ts
@@ -24,6 +24,7 @@ export class PlaceContribJob implements OnApplicationBootstrap {
private readonly registrar: CronRegistrarService,
) {}
+ /** @txIndependent two schedules, each registered on its own; neither touches the database. */
onApplicationBootstrap(): void {
if (!this.registrar.isEnabled()) return;
this.registrar.register('place-contrib-send', SEND_SCHEDULE, () => this.send());
diff --git a/server/tests/e2e/place-contrib.e2e.test.ts b/server/tests/e2e/place-contrib.e2e.test.ts
index b5dc374ff..6ac5f0eed 100644
--- a/server/tests/e2e/place-contrib.e2e.test.ts
+++ b/server/tests/e2e/place-contrib.e2e.test.ts
@@ -10,6 +10,7 @@
import { AuditLog } from '../../src/db/entities/AuditLog.entity';
import { PlaceContribLog } from '../../src/db/entities/PlaceContribLog.entity';
import { servicesConfig } from '../../src/nest/app-config/tokens';
+import { inOrder } from '../../src/nest/common/in-order';
import { TrekExceptionFilter } from '../../src/nest/common/trek-exception.filter';
import { ZodValidationPipe } from '../../src/nest/common/zod-validation.pipe';
import { PlaceContribModule } from '../../src/nest/place-contrib/place-contrib.module';
@@ -91,12 +92,11 @@ describe('the guards', () => {
() => request(server).get(`${BASE}/log`),
() => request(server).post(`${BASE}/withdraw`).send({ confirm: true }),
];
- await Promise.all(
- routes.map(async (route) => {
- expect((await route()).status).toBe(401);
- expect((await route().set(as(USER))).status).toBe(403);
- }),
- );
+ // One after another: the test server resets connections opened all at once.
+ await inOrder(routes, async (route) => {
+ expect((await route()).status).toBe(401);
+ expect((await route().set(as(USER))).status).toBe(403);
+ });
expect(fetchMock).not.toHaveBeenCalled();
});
});
@@ -153,12 +153,10 @@ describe('the state and the decisions', () => {
{ action: 'agree', termsVersion: 1, fields: { website: true } },
{ action: 'fields', fields: FIELDS, withdraw: 'yes' },
];
- await Promise.all(
- bodies.map(async (body) => {
- const res = await request(server).put(`${BASE}/decision`).set(as(ADMIN)).send(body);
- expect(res.status, JSON.stringify(body)).toBe(400);
- }),
- );
+ await inOrder(bodies, async (body) => {
+ const res = await request(server).put(`${BASE}/decision`).set(as(ADMIN)).send(body);
+ expect(res.status, JSON.stringify(body)).toBe(400);
+ });
});
it('PCE2E-014: "Not now" answers when the prompt comes back for this admin', async () => {
diff --git a/server/tests/unit/plugins/rpc-fallbacks.test.ts b/server/tests/unit/plugins/rpc-fallbacks.test.ts
index 23523cebb..f33bfb73d 100644
--- a/server/tests/unit/plugins/rpc-fallbacks.test.ts
+++ b/server/tests/unit/plugins/rpc-fallbacks.test.ts
@@ -33,6 +33,9 @@ import type { EntityManager } from '@mikro-orm/core';
import { describe, it, expect, vi } from 'vitest';
+/** The origin bookkeeping a place write does after it; these cases never reach it. */
+const ORIGINS = { record: vi.fn(), recordImported: vi.fn(), valuesBefore: vi.fn(() => null) } as never;
+
const req = (method: string, params: Record<string, unknown> = {}): RpcRequest => ({
k: 'req',
id: 'x',
@@ -195,7 +198,7 @@ describe('a service that says no becomes a refusal, not a crash', () => {
'p',
ALL,
makeDeps(),
- createTestPluginRegistry([new PlacesRpc(places, journey, realtime(), guards)]),
+ createTestPluginRegistry([new PlacesRpc(places, journey, realtime(), guards, ORIGINS)]),
);
expect(err(await host.dispatch(req('places.delete', { tripId: 1, placeId: 7 }), 42)).message).toBe(
'no place 7 on trip 1',
@@ -408,7 +411,7 @@ describe('every schema-validated method rejects a payload its schema refuses', (
{ get: () => vi.fn(() => ({ id: 1, trip: { id: 1 }, updatedTrip: { id: 1 }, reservation: { id: 1 } })) },
) as never;
const registry = createTestPluginRegistry([
- new PlacesRpc(anything, anything, realtime(), guards),
+ new PlacesRpc(anything, anything, realtime(), guards, anything),
new DaysRpc(anything, realtime(), guards, anything),
new PackingRpc(anything, realtime(), guards),
new TripsRpc(anything, anything, anything, anything, realtime(), guards, anything, anything, em),