From 1a93b0d7056c0d523eb7fed8ecc9bbb1023ac0d3 Mon Sep 17 00:00:00 2001 From: Steve Larson <9larsons@gmail.com> Date: Tue, 18 Aug 2026 11:21:22 -0500 Subject: [PATCH 01/21] Removed NiceModal from settings and Shade (#30017) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no ref Every settings dialog now renders as a controlled component, either from its route or from the component that opens it, so nothing is created or shown through NiceModal any more. This removes: - the `NiceModal.Provider` from the settings app - the NiceModal fallback paths from Shade's `SettingsModal` and the settings `PreviewModalContent` — `onClose` is now required on both (every consumer already passed it) - the `@ebay/nice-modal-react` dependency from admin, Shade and admin-x-framework (which had it listed but never imported it), plus its catalog entry and lockfile entries --- apps/admin-x-framework/package.json | 1 - apps/admin/package.json | 1 - apps/admin/src/settings/app/app.tsx | 9 ++-- .../providers/confirmation-provider.tsx | 5 +- .../app/components/settings/preview-modal.tsx | 30 +++-------- apps/shade/package.json | 1 - .../patterns/settings-modal.stories.tsx | 18 +++---- .../components/patterns/settings-modal.tsx | 32 +++--------- .../patterns/settings-modal.test.tsx | 48 ++++------------- .../components/ui/overlay-escape.test.tsx | 52 +++++-------------- pnpm-lock.yaml | 23 -------- pnpm-workspace.yaml | 1 - 12 files changed, 47 insertions(+), 174 deletions(-) diff --git a/apps/admin-x-framework/package.json b/apps/admin-x-framework/package.json index 4c74d3c9c28..9e937596725 100644 --- a/apps/admin-x-framework/package.json +++ b/apps/admin-x-framework/package.json @@ -95,7 +95,6 @@ "vitest": "catalog:" }, "dependencies": { - "@ebay/nice-modal-react": "catalog:", "@sentry/react": "catalog:", "@tanstack/react-query": "catalog:", "@tinybirdco/charts": "0.3.0", diff --git a/apps/admin/package.json b/apps/admin/package.json index e778f87b099..532e69fc8f8 100644 --- a/apps/admin/package.json +++ b/apps/admin/package.json @@ -25,7 +25,6 @@ "@codemirror/state": "catalog:", "@codemirror/theme-one-dark": "catalog:", "@dnd-kit/sortable": "catalog:", - "@ebay/nice-modal-react": "catalog:", "@sentry/react": "catalog:", "@svg-maps/world": "2.0.0", "@tanstack/react-query": "catalog:", diff --git a/apps/admin/src/settings/app/app.tsx b/apps/admin/src/settings/app/app.tsx index 992ac686b99..3db6609d3d5 100644 --- a/apps/admin/src/settings/app/app.tsx +++ b/apps/admin/src/settings/app/app.tsx @@ -1,5 +1,4 @@ import MainContent from './main-content'; -import NiceModal from '@ebay/nice-modal-react'; import SettingsAppProvider, {type UpgradeStatusType} from './components/providers/settings-app-provider'; import {ConfirmationProvider} from './components/providers/confirmation-provider'; import {DialogPortalProvider} from './components/providers/dialog-portal'; @@ -31,11 +30,9 @@ export function App({upgradeStatus}: AppProps) {
Sensitive post
', + url: 'https://example.com/posts/sensitive', + sensitive: true, + contentWarning: 'Sensitive topic', + likeCount: 0, + likedByMe: false, + repostCount: 0, + repostedByMe: false, + replyCount: 0, + attachments: [] + } }, { id: 'https://example.com/notifications/def456', @@ -1380,7 +1542,22 @@ describe('ActivityPubAPI', function () { expect(actual.notifications).toEqual([ { id: 'https://example.com/notifications/abc123', - type: 'like' + type: 'like', + post: { + id: 'https://example.com/posts/sensitive', + type: 'note', + title: null, + content: 'Sensitive post
', + url: 'https://example.com/posts/sensitive', + sensitive: true, + contentWarning: 'Sensitive topic', + likeCount: 0, + likedByMe: false, + repostCount: 0, + repostedByMe: false, + replyCount: 0, + attachments: [] + } }, { id: 'https://example.com/notifications/def456', diff --git a/apps/activitypub/src/api/activitypub.ts b/apps/activitypub/src/api/activitypub.ts index 8f6cd6a23c4..ece9ed9a4d4 100644 --- a/apps/activitypub/src/api/activitypub.ts +++ b/apps/activitypub/src/api/activitypub.ts @@ -159,6 +159,8 @@ export interface Notification { title: string | null; content: string; url: string; + sensitive?: boolean; + contentWarning?: string | null; likeCount: number; likedByMe: boolean; repostCount: number; @@ -177,6 +179,8 @@ export interface Notification { title: string | null; content: string; url: string; + sensitive?: boolean; + contentWarning?: string | null; }, createdAt: string; } @@ -206,6 +210,23 @@ export interface SocialWebDomain { actorUrl: string; } +export interface Preferences { + showSensitiveMedia: boolean; +} + +/** + * Fails closed: anything the server doesn't explicitly confirm leaves sensitive + * media hidden. + */ +function parsePreferences(json: object | null): Preferences { + return { + showSensitiveMedia: + json !== null && + 'showSensitiveMedia' in json && + json.showSensitiveMedia === true + }; +} + export const PostType = { Note: 0, Article: 1, @@ -220,6 +241,8 @@ export interface Post { title: string; excerpt: string; summary: string | null; + sensitive?: boolean; + contentWarning?: string | null; content: string; url: string; featureImageUrl: string | null; @@ -684,6 +707,26 @@ export class ActivityPubAPI { return {count}; } + async getPreferences(): Promise