From 4a2b7faa594d24dcc97ac56fea78513dd37ec710 Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Tue, 9 May 2023 15:16:13 -0400 Subject: [PATCH] Support soft-deleted statuses via tombstones --- app/soapbox/components/status.tsx | 12 ++++++++++++ app/soapbox/components/tombstone.tsx | 15 +++++++++++---- .../status/components/thread-status.tsx | 5 ++--- app/soapbox/normalizers/status.ts | 17 ++++++++++++++++- app/soapbox/schemas/index.ts | 1 + app/soapbox/schemas/status.ts | 5 +++++ app/soapbox/schemas/tombstone.ts | 9 +++++++++ app/styles/components/detailed-status.scss | 10 ---------- 8 files changed, 56 insertions(+), 18 deletions(-) create mode 100644 app/soapbox/schemas/tombstone.ts diff --git a/app/soapbox/components/status.tsx b/app/soapbox/components/status.tsx index 8456a46a4..0c1a7be59 100644 --- a/app/soapbox/components/status.tsx +++ b/app/soapbox/components/status.tsx @@ -21,6 +21,7 @@ import StatusMedia from './status-media'; import StatusReplyMentions from './status-reply-mentions'; import SensitiveContentOverlay from './statuses/sensitive-content-overlay'; import StatusInfo from './statuses/status-info'; +import Tombstone from './tombstone'; import { Card, Icon, Stack, Text } from './ui'; import type { @@ -388,6 +389,17 @@ const Status: React.FC = (props) => { const isUnderReview = actualStatus.visibility === 'self'; const isSensitive = actualStatus.hidden; + const isSoftDeleted = status.tombstone?.reason === 'deleted'; + + if (isSoftDeleted) { + return ( + onMoveUp ? onMoveUp(id) : null} + onMoveDown={(id) => onMoveDown ? onMoveDown(id) : null} + /> + ); + } return ( diff --git a/app/soapbox/components/tombstone.tsx b/app/soapbox/components/tombstone.tsx index 6c6a2a6f9..b92fb7e70 100644 --- a/app/soapbox/components/tombstone.tsx +++ b/app/soapbox/components/tombstone.tsx @@ -19,10 +19,17 @@ const Tombstone: React.FC = ({ id, onMoveUp, onMoveDown }) => { return ( -
- - - +
+
+ + + +
); diff --git a/app/soapbox/features/status/components/thread-status.tsx b/app/soapbox/features/status/components/thread-status.tsx index 8f3e5b249..442bae0e3 100644 --- a/app/soapbox/features/status/components/thread-status.tsx +++ b/app/soapbox/features/status/components/thread-status.tsx @@ -31,9 +31,8 @@ const ThreadStatus: React.FC = (props): JSX.Element => { return (