chore(slideshow): renumber migrations to 138/139 (after whatsapp #649's 137)

PR #649 takes migration 137 (add_whatsapp_template_language). Renumber the
slideshow migrations to slot in after it:
- 137_add_slideshow_share.js  -> 138_add_slideshow_share.js
- 138_add_slideshow_styling.js -> 139_add_slideshow_styling.js
and update the slideshow migration-number references in comments/types. No
content change — both are additive + addColumnIfNotExists-guarded, so re-running
under the new filename on an already-migrated DB is a safe no-op.
This commit is contained in:
Luca
2026-06-21 02:59:19 +02:00
parent a995131f42
commit e6655f613b
9 changed files with 99 additions and 9 deletions
@@ -1,7 +1,7 @@
/**
* <SlideshowSettingsCard>
*
* Per-event "Live Slideshow" ("Diashow") admin surface (migrations 137/138).
* Per-event "Live Slideshow" ("Diashow") admin surface (migrations 138/139).
* A token-only fullscreen kiosk link for live events that auto-picks-up new
* uploads while it runs. Mounted once on the EventDetailsPage; admin can:
* - Generate the slideshow link on demand (mints show_share_token)
@@ -2159,7 +2159,7 @@ export const EventDetailsPage: React.FC = () => {
</div>
</Card>
{/* Live Slideshow ("Diashow") link + live display settings (migrations 137/138).
{/* Live Slideshow ("Diashow") link + live display settings (migrations 138/139).
Gated behind the `slideshow` feature flag. */}
{flags.slideshow && (
<SlideshowSettingsCard
@@ -0,0 +1,90 @@
import { render, screen, waitFor } from '@testing-library/react';
import { vi } from 'vitest';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { GALLERY_THEME_PRESETS } from '../../../types/theme.types';
const CSS = '.gallery-premium-footer p:first-child { display: none; }';
const savedTheme = { ...GALLERY_THEME_PRESETS.galleryPremium.config, customCss: CSS };
// --- mocks -----------------------------------------------------------------
vi.mock('react-i18next', async () => {
const actual = await vi.importActual<typeof import('react-i18next')>('react-i18next');
return {
...actual,
useTranslation: () => ({ t: (k: string, fb?: unknown) => (typeof fb === 'string' ? fb : k) })
};
});
vi.mock('react-toastify', () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
vi.mock('../../../services/settings.service', async () => {
const actual = await vi.importActual<any>('../../../services/settings.service');
return {
...actual,
settingsService: {
...actual.settingsService,
getSettingsByType: vi.fn(async (type: string) =>
type === 'theme' ? { theme_config: savedTheme } : {}
),
getAllSettings: vi.fn(async () => ({ thumbnail_width: '800', thumbnail_height: '800' })),
updateTheme: vi.fn(async () => undefined),
updateBranding: vi.fn(async () => undefined),
},
};
});
vi.mock('../../../services/fonts.service', () => ({
fontsService: { list: vi.fn(async () => []) },
extractFamilyName: (s: string) => s,
}));
vi.mock('../../../services/businessProfile.service', () => ({
businessProfileService: { get: vi.fn(async () => ({ profile: {} })), update: vi.fn() },
}));
vi.mock('../../../hooks/usePublicSettings', () => ({
PUBLIC_SETTINGS_QUERY_KEY: ['public-settings'],
usePublicSettings: () => ({ data: { branding_force_color_mode: null } }),
}));
vi.mock('../../../contexts/FeatureFlagsContext', () => ({
useFeatureFlags: () => ({ flags: {} }),
useFeatureEnabled: () => false,
}));
// Heavy/unrelated children — stub to keep the test focused on the CSS textarea.
vi.mock('../../../components/admin/CustomerDashboardBrandingCard', () => ({
CustomerDashboardBrandingCard: () => null,
}));
vi.mock('../../../components/admin/PdfTypographyCard', () => ({
PdfTypographyCard: () => null,
}));
vi.mock('../../../components/admin', async () => {
const actual = await vi.importActual<any>('../../../components/admin');
return { ...actual, GalleryPreview: () => null };
});
import { BrandingPage } from '../BrandingPage';
import { ThemeProvider } from '../../../contexts/ThemeContext';
describe('BrandingPage custom CSS persistence (#645)', () => {
beforeEach(() => localStorage.clear());
it('shows the saved custom CSS in the textarea on load for a Gallery Premium theme', async () => {
const qc = new QueryClient({ defaultOptions: { queries: { retry: false } } });
render(
<QueryClientProvider client={qc}>
<ThemeProvider>
<BrandingPage />
</ThemeProvider>
</QueryClientProvider>
);
const textarea = (await screen.findByPlaceholderText(
'/* Add custom CSS here */'
)) as HTMLTextAreaElement;
await waitFor(() => expect(textarea.value).toBe(CSS));
});
});
+1 -1
View File
@@ -67,7 +67,7 @@ export interface Event {
// Client access (#172)
client_access_enabled?: boolean;
client_share_token?: string;
// Live Slideshow / "Diashow" (migration 137). Token-only fullscreen kiosk
// Live Slideshow / "Diashow" (migration 138). Token-only fullscreen kiosk
// link minted on demand; null token = disabled. Settings drive the running
// projector and can be changed live.
show_share_token?: string | null;