fix(cms): keep the Atlantisz reference pending until logo and name are settled (MITHOME-133)
The Atlantisz logo has white lettering made for a dark header, invisible on our light background, and its official name differs between the logo and the admin entry. The partner_references migration now classifies it as a pending client reference in environments where it has not run yet; the follow-up 20260929_atlantisz_pending migration moves the already granted staging entry to pending, touching only the automatic classification (a later admin decision is left alone). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c6a4bd9bc9
commit
3505806358
@@ -100,7 +100,7 @@ function buildHomeData(json: typeof homeJson) {
|
||||
function partnerMeta(name: string) {
|
||||
const confirmed = CONFIRMED_CLIENT_REFERENCES.find((c) => c.name === name)
|
||||
return confirmed
|
||||
? { relationship: 'client-reference' as const, publicationPermission: 'granted' as const, permissionReference: confirmed.permissionReference }
|
||||
? { relationship: 'client-reference' as const, publicationPermission: confirmed.permission, permissionReference: confirmed.permissionReference }
|
||||
: { relationship: 'client-reference' as const, publicationPermission: 'none' as const }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { classifyPartner, seedReferencesSection, up } from '../migrations/20260929_partner_references'
|
||||
import { markAtlantiszPending, PENDING_REFERENCE } from '../migrations/20260929_atlantisz_pending'
|
||||
import { fakeArgs, fakeCollection } from './helpers/fake-mongo'
|
||||
|
||||
type Doc = Record<string, unknown>
|
||||
@@ -11,10 +12,25 @@ describe('20260929_partner_references migration (MITHOME-131)', () => {
|
||||
expect(doc.permissionReference).toMatch(/Írásos engedély/)
|
||||
})
|
||||
|
||||
it('should mark the Atlantisz contracted client as a client reference too', () => {
|
||||
it('should mark the Atlantisz contracted client as a client reference, pending until its logo is settled', () => {
|
||||
const doc: Doc = { name: 'Atlantisz Horgászüdülő és Halásztanya' }
|
||||
classifyPartner(doc)
|
||||
expect(doc).toMatchObject({ relationship: 'client-reference', publicationPermission: 'granted' })
|
||||
expect(doc).toMatchObject({ relationship: 'client-reference', publicationPermission: 'pending' })
|
||||
})
|
||||
|
||||
it('should move an already granted Atlantisz entry to pending, but respect later admin decisions', () => {
|
||||
const auto: Doc = {
|
||||
name: 'Atlantisz Horgászüdülő és Halásztanya',
|
||||
publicationPermission: 'granted',
|
||||
permissionReference: 'Írásos engedély megvan (tulajdonosi megerősítés, 2026-09-29)',
|
||||
}
|
||||
expect(markAtlantiszPending(auto)).toBe(1)
|
||||
expect(auto).toMatchObject({ publicationPermission: 'pending', permissionReference: PENDING_REFERENCE })
|
||||
expect(markAtlantiszPending(auto)).toBe(0)
|
||||
const admin: Doc = { name: 'Atlantisz Horgászüdülő és Halásztanya', publicationPermission: 'granted', permissionReference: 'E-mail, 2026-10-05' }
|
||||
expect(markAtlantiszPending(admin)).toBe(0)
|
||||
const angele: Doc = { name: 'Angele Pihenőház', publicationPermission: 'granted', permissionReference: 'Írásos engedély megvan (tulajdonosi megerősítés, 2026-09-29)' }
|
||||
expect(markAtlantiszPending(angele)).toBe(0)
|
||||
})
|
||||
|
||||
it('should hide any other uncategorised entry until someone classifies it', () => {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* MITHOME-133: az Atlantisz Horgászüdülő és Halásztanya bejegyzést
|
||||
* "Egyeztetés alatt" állapotba teszi, amíg a logó (fehér felirat, világos
|
||||
* háttéren olvashatatlan) és a hivatalos név rendeződik.
|
||||
*
|
||||
* WHY külön migráció: a 20260929_partner_references a stagingen már
|
||||
* "granted" állapottal lefutott; a még le nem futott környezetekben az
|
||||
* eleve "pending"-et állít. Csak a saját, automatikus besorolást írja
|
||||
* felül (egyező permissionReference) — egy későbbi admin-döntéshez nem nyúl.
|
||||
*/
|
||||
import type { MigrateDownArgs, MigrateUpArgs } from '@payloadcms/db-mongodb'
|
||||
|
||||
import { rewriteDocs } from '../lib/migrate-global-docs'
|
||||
|
||||
const NAME = 'Atlantisz Horgászüdülő és Halásztanya'
|
||||
const AUTO_GRANTED_REFERENCE = 'Írásos engedély megvan (tulajdonosi megerősítés, 2026-09-29)'
|
||||
export const PENDING_REFERENCE = 'Írásos engedély megvan; logó és hivatalos név egyeztetés alatt (MITHOME-133)'
|
||||
|
||||
export function markAtlantiszPending(doc: Record<string, unknown>): number {
|
||||
if (doc.name !== NAME || doc.publicationPermission !== 'granted' || doc.permissionReference !== AUTO_GRANTED_REFERENCE) {
|
||||
return 0
|
||||
}
|
||||
doc.publicationPermission = 'pending'
|
||||
doc.permissionReference = PENDING_REFERENCE
|
||||
return 1
|
||||
}
|
||||
|
||||
export async function up(args: MigrateUpArgs): Promise<void> {
|
||||
const changed = await rewriteDocs(
|
||||
args,
|
||||
{ kind: 'collection', slug: 'partners' },
|
||||
['publicationPermission', 'permissionReference'],
|
||||
markAtlantiszPending,
|
||||
{ versions: 'latest' },
|
||||
)
|
||||
args.payload.logger.info(`MITHOME-133 Atlantisz: ${changed} record(s) set to pending`)
|
||||
}
|
||||
|
||||
/** DECISION: no automatic down — set the status in the admin instead. */
|
||||
export async function down(args: MigrateDownArgs): Promise<void> {
|
||||
args.payload.logger.warn('MITHOME-133 Atlantisz: down is a no-op — change the status in the admin instead')
|
||||
}
|
||||
@@ -20,13 +20,17 @@ type Data = Record<string, unknown>
|
||||
export const CONFIRMED_CLIENT_REFERENCES = [
|
||||
{
|
||||
name: 'Angele Pihenőház',
|
||||
permission: 'granted',
|
||||
permissionReference: 'Írásos engedély megvan (tulajdonosi megerősítés, 2026-09-29)',
|
||||
},
|
||||
{
|
||||
// Contracted client (its site runs on our infrastructure) — a client
|
||||
// reference, not a partner, per the research's categories.
|
||||
// Kept "pending" until the logo (white text, unreadable on a light
|
||||
// background) and the official name are settled (MITHOME-133).
|
||||
name: 'Atlantisz Horgászüdülő és Halásztanya',
|
||||
permissionReference: 'Írásos engedély megvan (tulajdonosi megerősítés, 2026-09-29)',
|
||||
permission: 'pending',
|
||||
permissionReference: 'Írásos engedély megvan; logó és hivatalos név egyeztetés alatt (MITHOME-133)',
|
||||
},
|
||||
] as const
|
||||
|
||||
@@ -63,7 +67,7 @@ export function classifyPartner(doc: Data): number {
|
||||
const confirmed = CONFIRMED_CLIENT_REFERENCES.find((c) => c.name === doc.name)
|
||||
if (confirmed) {
|
||||
doc.relationship = 'client-reference'
|
||||
doc.publicationPermission = 'granted'
|
||||
doc.publicationPermission = confirmed.permission
|
||||
doc.permissionReference = confirmed.permissionReference
|
||||
} else {
|
||||
doc.publicationPermission = 'none'
|
||||
|
||||
@@ -4,6 +4,7 @@ import * as migration_20260929_localize_legal_pages from './20260929_localize_le
|
||||
import * as migration_20260929_en_ai_draft from './20260929_en_ai_draft'
|
||||
import * as migration_20260929_service_claims from './20260929_service_claims'
|
||||
import * as migration_20260929_partner_references from './20260929_partner_references'
|
||||
import * as migration_20260929_atlantisz_pending from './20260929_atlantisz_pending'
|
||||
|
||||
/**
|
||||
* Payload migrations, in order. Passed to `mongooseAdapter({ prodMigrations })`
|
||||
@@ -45,4 +46,10 @@ export const migrations = [
|
||||
down: migration_20260929_partner_references.down,
|
||||
name: '20260929_partner_references',
|
||||
},
|
||||
{
|
||||
// MITHOME-133 — Atlantisz on hold until logo and official name are settled.
|
||||
up: migration_20260929_atlantisz_pending.up,
|
||||
down: migration_20260929_atlantisz_pending.down,
|
||||
name: '20260929_atlantisz_pending',
|
||||
},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user