From 4faed38f472e75bbf909e2187f21bce21d577eb2 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Mon, 2 Mar 2026 12:39:07 +0100 Subject: [PATCH] chore: remove explicit email and phone inline blocks in favor of automatic obfuscation --- .gitea/workflows/qa.yml | 108 +++++++++++++++++--------------- components/PayloadRichText.tsx | 8 --- payload.config.ts | 3 - src/payload/blocks/Email.ts | 25 -------- src/payload/blocks/Phone.ts | 28 --------- src/payload/blocks/allBlocks.ts | 4 -- 6 files changed, 59 insertions(+), 117 deletions(-) delete mode 100644 src/payload/blocks/Email.ts delete mode 100644 src/payload/blocks/Phone.ts diff --git a/.gitea/workflows/qa.yml b/.gitea/workflows/qa.yml index 80ba071a..a50380d9 100644 --- a/.gitea/workflows/qa.yml +++ b/.gitea/workflows/qa.yml @@ -11,10 +11,10 @@ env: jobs: # ──────────────────────────────────────────────────── - # 1. Install & Cache Dependencies + # 1. Static Checks (HTML, Assets, HTTP) # ──────────────────────────────────────────────────── - install: - name: 📦 Install + static: + name: 🔍 Static Analysis runs-on: docker container: image: catthehacker/ubuntu:act-latest @@ -30,39 +30,17 @@ jobs: run: | echo "@mintel:registry=https://git.infra.mintel.me/api/packages/mmintel/npm" > .npmrc echo "//git.infra.mintel.me/api/packages/mmintel/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc + - name: 📦 Cache node_modules + uses: actions/cache@v4 + id: cache-deps + with: + path: node_modules + key: pnpm-${{ hashFiles('pnpm-lock.yaml') }} - name: Install + if: steps.cache-deps.outputs.cache-hit != 'true' run: | pnpm store prune pnpm install --no-frozen-lockfile - - name: Upload workspace - uses: actions/upload-artifact@v4 - with: - name: workspace - path: | - node_modules - .npmrc - retention-days: 1 - - # ──────────────────────────────────────────────────── - # 2. Static Checks (HTML, Assets, HTTP) - # ──────────────────────────────────────────────────── - static: - name: 🔍 Static Analysis - needs: install - runs-on: docker - container: - image: catthehacker/ubuntu:act-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 - with: - version: 10 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - uses: actions/download-artifact@v4 - with: - name: workspace - name: 🌐 HTML Validation env: NEXT_PUBLIC_BASE_URL: ${{ env.TARGET_URL }} @@ -80,11 +58,10 @@ jobs: run: pnpm run check:http # ──────────────────────────────────────────────────── - # 3. Accessibility (WCAG) + # 2. Accessibility (WCAG) # ──────────────────────────────────────────────────── a11y: name: ♿ Accessibility - needs: install runs-on: docker container: image: catthehacker/ubuntu:act-latest @@ -96,9 +73,21 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - uses: actions/download-artifact@v4 + - name: 🔐 Registry Auth + run: | + echo "@mintel:registry=https://git.infra.mintel.me/api/packages/mmintel/npm" > .npmrc + echo "//git.infra.mintel.me/api/packages/mmintel/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc + - name: 📦 Cache node_modules + uses: actions/cache@v4 + id: cache-deps with: - name: workspace + path: node_modules + key: pnpm-${{ hashFiles('pnpm-lock.yaml') }} + - name: Install + if: steps.cache-deps.outputs.cache-hit != 'true' + run: | + pnpm store prune + pnpm install --no-frozen-lockfile - name: 🔍 Install Chromium run: | apt-get update && apt-get install -y gnupg wget ca-certificates @@ -117,11 +106,10 @@ jobs: run: pnpm run check:wcag # ──────────────────────────────────────────────────── - # 4. Performance (Lighthouse) + # 3. Performance (Lighthouse) # ──────────────────────────────────────────────────── lighthouse: name: 🎭 Lighthouse - needs: install runs-on: docker container: image: catthehacker/ubuntu:act-latest @@ -133,9 +121,21 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - uses: actions/download-artifact@v4 + - name: 🔐 Registry Auth + run: | + echo "@mintel:registry=https://git.infra.mintel.me/api/packages/mmintel/npm" > .npmrc + echo "//git.infra.mintel.me/api/packages/mmintel/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc + - name: 📦 Cache node_modules + uses: actions/cache@v4 + id: cache-deps with: - name: workspace + path: node_modules + key: pnpm-${{ hashFiles('pnpm-lock.yaml') }} + - name: Install + if: steps.cache-deps.outputs.cache-hit != 'true' + run: | + pnpm store prune + pnpm install --no-frozen-lockfile - name: 🔍 Install Chromium run: | apt-get update && apt-get install -y gnupg wget ca-certificates @@ -158,11 +158,10 @@ jobs: run: pnpm run pagespeed:test -- --collect.settings.preset=mobile # ──────────────────────────────────────────────────── - # 5. Link Check & Dependency Audit + # 4. Link Check & Dependency Audit # ──────────────────────────────────────────────────── links: name: 🔗 Links & Deps - needs: install runs-on: docker container: image: catthehacker/ubuntu:act-latest @@ -174,9 +173,21 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - uses: actions/download-artifact@v4 + - name: 🔐 Registry Auth + run: | + echo "@mintel:registry=https://git.infra.mintel.me/api/packages/mmintel/npm" > .npmrc + echo "//git.infra.mintel.me/api/packages/mmintel/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc + - name: 📦 Cache node_modules + uses: actions/cache@v4 + id: cache-deps with: - name: workspace + path: node_modules + key: pnpm-${{ hashFiles('pnpm-lock.yaml') }} + - name: Install + if: steps.cache-deps.outputs.cache-hit != 'true' + run: | + pnpm store prune + pnpm install --no-frozen-lockfile - name: 📦 Depcheck continue-on-error: true run: pnpm dlx depcheck --ignores="*eslint*,*typescript*,*tailwindcss*,*postcss*,*prettier*,*@types/*,*husky*,*lint-staged*,*@next/*,*@lhci/*,*commitlint*,*cspell*,*rimraf*,*@payloadcms/*,*start-server-and-test*,*html-validate*,*critters*,*dotenv*,*turbo*" @@ -187,11 +198,11 @@ jobs: fail: true # ──────────────────────────────────────────────────── - # 6. Notification + # 5. Notification # ──────────────────────────────────────────────────── notify: name: 🔔 Notify - needs: [install, static, a11y, lighthouse, links] + needs: [static, a11y, lighthouse, links] if: always() runs-on: docker container: @@ -200,13 +211,12 @@ jobs: - name: 🔔 Gotify shell: bash run: | - INSTALL="${{ needs.install.result }}" STATIC="${{ needs.static.result }}" A11Y="${{ needs.a11y.result }}" LIGHTHOUSE="${{ needs.lighthouse.result }}" LINKS="${{ needs.links.result }}" - if [[ "$INSTALL" != "success" || "$STATIC" != "success" || "$LIGHTHOUSE" != "success" ]]; then + if [[ "$STATIC" != "success" || "$LIGHTHOUSE" != "success" ]]; then PRIORITY=8 EMOJI="🚨" STATUS="Failed" @@ -217,7 +227,7 @@ jobs: fi TITLE="$EMOJI ${{ env.PROJECT_NAME }} QA $STATUS" - MESSAGE="Install: $INSTALL | Static: $STATIC | A11y: $A11Y | Lighthouse: $LIGHTHOUSE | Links: $LINKS + MESSAGE="Static: $STATIC | A11y: $A11Y | Lighthouse: $LIGHTHOUSE | Links: $LINKS ${{ env.TARGET_URL }}" curl -s -k -X POST "${{ secrets.GOTIFY_URL }}/message?token=${{ secrets.GOTIFY_TOKEN }}" \ diff --git a/components/PayloadRichText.tsx b/components/PayloadRichText.tsx index 0f55abb3..4e8753b2 100644 --- a/components/PayloadRichText.tsx +++ b/components/PayloadRichText.tsx @@ -1111,14 +1111,6 @@ const jsxConverters: JSXConverters = { ), - 'block-email': ({ node }: any) => { - const { email, label } = node.fields; - return {label || email}; - }, - 'block-phone': ({ node }: any) => { - const { phone, label } = node.fields; - return {label || phone}; - }, }, // Custom converter for the Payload "upload" Lexical node (Media collection) // This natively reconstructs Next.js tags pointing to the focal-point cropped sizes diff --git a/payload.config.ts b/payload.config.ts index eac89177..289ba29c 100644 --- a/payload.config.ts +++ b/payload.config.ts @@ -21,8 +21,6 @@ import { Posts } from './src/payload/collections/Posts'; import { FormSubmissions } from './src/payload/collections/FormSubmissions'; import { Products } from './src/payload/collections/Products'; import { Pages } from './src/payload/collections/Pages'; -import { Email } from './src/payload/blocks/Email'; -import { Phone } from './src/payload/blocks/Phone'; import { seedDatabase } from './src/payload/seed'; const filename = fileURLToPath(import.meta.url); @@ -64,7 +62,6 @@ export default buildConfig({ ...defaultFeatures, BlocksFeature({ blocks: payloadBlocks, - inlineBlocks: [Email, Phone], }), ], }), diff --git a/src/payload/blocks/Email.ts b/src/payload/blocks/Email.ts deleted file mode 100644 index b2460939..00000000 --- a/src/payload/blocks/Email.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Block } from 'payload'; - -export const Email: Block = { - slug: 'email', - interfaceName: 'EmailBlock', - labels: { - singular: 'Email (Inline)', - plural: 'Emails (Inline)', - }, - fields: [ - { - name: 'email', - type: 'text', - required: true, - }, - { - name: 'label', - type: 'text', - required: false, - admin: { - placeholder: 'Optional: Custom link text', - }, - }, - ], -}; diff --git a/src/payload/blocks/Phone.ts b/src/payload/blocks/Phone.ts deleted file mode 100644 index 8370860a..00000000 --- a/src/payload/blocks/Phone.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Block } from 'payload'; - -export const Phone: Block = { - slug: 'phone', - interfaceName: 'PhoneBlock', - labels: { - singular: 'Phone (Inline)', - plural: 'Phones (Inline)', - }, - fields: [ - { - name: 'phone', - type: 'text', - required: true, - admin: { - placeholder: '+49 123 456 789', - }, - }, - { - name: 'label', - type: 'text', - required: false, - admin: { - placeholder: 'Optional: Custom link text', - }, - }, - ], -}; diff --git a/src/payload/blocks/allBlocks.ts b/src/payload/blocks/allBlocks.ts index 16d718b6..d5d63066 100644 --- a/src/payload/blocks/allBlocks.ts +++ b/src/payload/blocks/allBlocks.ts @@ -1,6 +1,4 @@ import { AnimatedImage } from './AnimatedImage'; -import { Email } from './Email'; -import { Phone } from './Phone'; import { Callout } from './Callout'; import { CategoryGrid } from './CategoryGrid'; import { ChatBubble } from './ChatBubble'; @@ -23,8 +21,6 @@ import { homeBlocksArray } from './HomeBlocks'; export const payloadBlocks = [ ...homeBlocksArray, AnimatedImage, - Email, - Phone, Callout, CategoryGrid, ChatBubble,