feat(posts): add purge UI feedback for mods

Show Purged author/ID, red content message, and file-deleted media when
post.commentModeration.purged is true. Mirrors removal UI pattern.
This commit is contained in:
plebeius
2026-03-06 21:44:33 +08:00
parent c69c46442b
commit ae744d0f78
40 changed files with 163 additions and 54 deletions
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "رابط للملف", "link_to_file": "رابط للملف",
"support_5chan": "دعم 5chan", "support_5chan": "دعم 5chan",
"images": "صور", "images": "صور",
"load_more": "تحميل المزيد" "load_more": "تحميل المزيد",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "ফাইলের লিংক", "link_to_file": "ফাইলের লিংক",
"support_5chan": "5chan সমর্থন করুন", "support_5chan": "5chan সমর্থন করুন",
"images": "ছবি", "images": "ছবি",
"load_more": "আরও লোড করুন" "load_more": "আরও লোড করুন",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Odkaz na soubor", "link_to_file": "Odkaz na soubor",
"support_5chan": "Podpořte 5chan", "support_5chan": "Podpořte 5chan",
"images": "obrázky", "images": "obrázky",
"load_more": "Načíst více" "load_more": "Načíst více",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Link til fil", "link_to_file": "Link til fil",
"support_5chan": "Støt 5chan", "support_5chan": "Støt 5chan",
"images": "billeder", "images": "billeder",
"load_more": "Indlæs mere" "load_more": "Indlæs mere",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Link zur Datei", "link_to_file": "Link zur Datei",
"support_5chan": "5chan unterstützen", "support_5chan": "5chan unterstützen",
"images": "Bilder", "images": "Bilder",
"load_more": "Mehr laden" "load_more": "Mehr laden",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Σύνδεσμος προς αρχείο", "link_to_file": "Σύνδεσμος προς αρχείο",
"support_5chan": "Υποστηρίξτε το 5chan", "support_5chan": "Υποστηρίξτε το 5chan",
"images": "εικόνες", "images": "εικόνες",
"load_more": "Φόρτωση περισσότερων" "load_more": "Φόρτωση περισσότερων",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+2
View File
@@ -228,6 +228,8 @@
"bitsocial_account": "Bitsocial Account", "bitsocial_account": "Bitsocial Account",
"purge": "purge", "purge": "purge",
"purge_confirm": "Purging permanently removes this content and all its replies from the database. Continue?", "purge_confirm": "Purging permanently removes this content and all its replies from the database. Continue?",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible.",
"mod_queue": "Mod Queue", "mod_queue": "Mod Queue",
"moderation_queue": "Moderation Queue", "moderation_queue": "Moderation Queue",
"queue_is_empty": "Queue is empty", "queue_is_empty": "Queue is empty",
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Enlace al archivo", "link_to_file": "Enlace al archivo",
"support_5chan": "Apoyar 5chan", "support_5chan": "Apoyar 5chan",
"images": "imágenes", "images": "imágenes",
"load_more": "Cargar más" "load_more": "Cargar más",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "لینک به فایل", "link_to_file": "لینک به فایل",
"support_5chan": "از 5chan پشتیبانی کنید", "support_5chan": "از 5chan پشتیبانی کنید",
"images": "تصاویر", "images": "تصاویر",
"load_more": "بارگذاری بیشتر" "load_more": "بارگذاری بیشتر",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Linkki tiedostoon", "link_to_file": "Linkki tiedostoon",
"support_5chan": "Tue 5chan", "support_5chan": "Tue 5chan",
"images": "kuvat", "images": "kuvat",
"load_more": "Lataa lisää" "load_more": "Lataa lisää",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Link sa File", "link_to_file": "Link sa File",
"support_5chan": "Suportahan ang 5chan", "support_5chan": "Suportahan ang 5chan",
"images": "mga larawan", "images": "mga larawan",
"load_more": "Mag-load ng higit pa" "load_more": "Mag-load ng higit pa",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Lien vers le fichier", "link_to_file": "Lien vers le fichier",
"support_5chan": "Soutenir 5chan", "support_5chan": "Soutenir 5chan",
"images": "images", "images": "images",
"load_more": "Charger plus" "load_more": "Charger plus",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "קישור לקובץ", "link_to_file": "קישור לקובץ",
"support_5chan": "תמוך ב-5chan", "support_5chan": "תמוך ב-5chan",
"images": "תמונות", "images": "תמונות",
"load_more": "טען עוד" "load_more": "טען עוד",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "फ़ाइल का लिंक", "link_to_file": "फ़ाइल का लिंक",
"support_5chan": "5chan का समर्थन करें", "support_5chan": "5chan का समर्थन करें",
"images": "छवियाँ", "images": "छवियाँ",
"load_more": "और लोड करें" "load_more": "और लोड करें",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Link a fájlhoz", "link_to_file": "Link a fájlhoz",
"support_5chan": "5chan támogatása", "support_5chan": "5chan támogatása",
"images": "képek", "images": "képek",
"load_more": "További betöltése" "load_more": "További betöltése",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Tautan ke File", "link_to_file": "Tautan ke File",
"support_5chan": "Dukung 5chan", "support_5chan": "Dukung 5chan",
"images": "gambar", "images": "gambar",
"load_more": "Muat lebih banyak" "load_more": "Muat lebih banyak",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Link al file", "link_to_file": "Link al file",
"support_5chan": "Supporta 5chan", "support_5chan": "Supporta 5chan",
"images": "immagini", "images": "immagini",
"load_more": "Carica altro" "load_more": "Carica altro",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "ファイルへのリンク", "link_to_file": "ファイルへのリンク",
"support_5chan": "5chanをサポート", "support_5chan": "5chanをサポート",
"images": "画像", "images": "画像",
"load_more": "さらに読み込む" "load_more": "さらに読み込む",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "파일 링크", "link_to_file": "파일 링크",
"support_5chan": "5chan 지원", "support_5chan": "5chan 지원",
"images": "이미지", "images": "이미지",
"load_more": "더 보기" "load_more": "더 보기",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "फाइलची लिंक", "link_to_file": "फाइलची लिंक",
"support_5chan": "5chan चे समर्थन करा", "support_5chan": "5chan चे समर्थन करा",
"images": "प्रतिमा", "images": "प्रतिमा",
"load_more": "अधिक लोड करा" "load_more": "अधिक लोड करा",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Link naar bestand", "link_to_file": "Link naar bestand",
"support_5chan": "Steun 5chan", "support_5chan": "Steun 5chan",
"images": "afbeeldingen", "images": "afbeeldingen",
"load_more": "Meer laden" "load_more": "Meer laden",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Lenke til fil", "link_to_file": "Lenke til fil",
"support_5chan": "Støtt 5chan", "support_5chan": "Støtt 5chan",
"images": "bilder", "images": "bilder",
"load_more": "Last inn mer" "load_more": "Last inn mer",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Link do pliku", "link_to_file": "Link do pliku",
"support_5chan": "Wspieraj 5chan", "support_5chan": "Wspieraj 5chan",
"images": "obrazy", "images": "obrazy",
"load_more": "Załaduj więcej" "load_more": "Załaduj więcej",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Link para o arquivo", "link_to_file": "Link para o arquivo",
"support_5chan": "Apoiar 5chan", "support_5chan": "Apoiar 5chan",
"images": "imagens", "images": "imagens",
"load_more": "Carregar mais" "load_more": "Carregar mais",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Link către fișier", "link_to_file": "Link către fișier",
"support_5chan": "Sprijiniți 5chan", "support_5chan": "Sprijiniți 5chan",
"images": "imagini", "images": "imagini",
"load_more": "Încarcă mai mult" "load_more": "Încarcă mai mult",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Ссылка на файл", "link_to_file": "Ссылка на файл",
"support_5chan": "Поддержать 5chan", "support_5chan": "Поддержать 5chan",
"images": "изображения", "images": "изображения",
"load_more": "Загрузить ещё" "load_more": "Загрузить ещё",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Lidhje me skedarin", "link_to_file": "Lidhje me skedarin",
"support_5chan": "Mbështetni 5chan", "support_5chan": "Mbështetni 5chan",
"images": "imazhe", "images": "imazhe",
"load_more": "Ngarko më shumë" "load_more": "Ngarko më shumë",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Länk till fil", "link_to_file": "Länk till fil",
"support_5chan": "Stöd 5chan", "support_5chan": "Stöd 5chan",
"images": "bilder", "images": "bilder",
"load_more": "Ladda mer" "load_more": "Ladda mer",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "ఫైల్‌కు లింక్", "link_to_file": "ఫైల్‌కు లింక్",
"support_5chan": "5chanకు మద్దతు ఇవ్వండి", "support_5chan": "5chanకు మద్దతు ఇవ్వండి",
"images": "చిత్రాలు", "images": "చిత్రాలు",
"load_more": "మరింత లోడ్ చేయండి" "load_more": "మరింత లోడ్ చేయండి",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "ลิงก์ไปยังไฟล์", "link_to_file": "ลิงก์ไปยังไฟล์",
"support_5chan": "สนับสนุน 5chan", "support_5chan": "สนับสนุน 5chan",
"images": "รูปภาพ", "images": "รูปภาพ",
"load_more": "โหลดเพิ่มเติม" "load_more": "โหลดเพิ่มเติม",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Dosyaya bağlantı", "link_to_file": "Dosyaya bağlantı",
"support_5chan": "5chan'ı Destekle", "support_5chan": "5chan'ı Destekle",
"images": "görseller", "images": "görseller",
"load_more": "Daha fazla yükle" "load_more": "Daha fazla yükle",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Посилання на файл", "link_to_file": "Посилання на файл",
"support_5chan": "Підтримати 5chan", "support_5chan": "Підтримати 5chan",
"images": "зображення", "images": "зображення",
"load_more": "Завантажити ще" "load_more": "Завантажити ще",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "فائل کا لنک", "link_to_file": "فائل کا لنک",
"support_5chan": "5chan کی حمایت کریں", "support_5chan": "5chan کی حمایت کریں",
"images": "تصاویر", "images": "تصاویر",
"load_more": "مزید لوڈ کریں" "load_more": "مزید لوڈ کریں",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "Liên kết đến tệp", "link_to_file": "Liên kết đến tệp",
"support_5chan": "Hỗ trợ 5chan", "support_5chan": "Hỗ trợ 5chan",
"images": "hình ảnh", "images": "hình ảnh",
"load_more": "Tải thêm" "load_more": "Tải thêm",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
+3 -1
View File
@@ -297,5 +297,7 @@
"link_to_file": "链接到文件", "link_to_file": "链接到文件",
"support_5chan": "支持 5chan", "support_5chan": "支持 5chan",
"images": "图片", "images": "图片",
"load_more": "加载更多" "load_more": "加载更多",
"purged": "purged",
"this_post_was_purged": "Purging from board database — this process is irreversible."
} }
@@ -71,6 +71,7 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => {
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const { cid, content, deleted, edit, original, parentCid, postCid, pendingApproval, quotedCids, reason, removed, state, subplebbitAddress } = post || {}; const { cid, content, deleted, edit, original, parentCid, postCid, pendingApproval, quotedCids, reason, removed, state, subplebbitAddress } = post || {};
const purged = post?.commentModeration?.purged;
const banned = !!post?.author?.subplebbit?.banExpiresAt; const banned = !!post?.author?.subplebbit?.banExpiresAt;
const [showFullComment, setShowFullComment] = useState(false); const [showFullComment, setShowFullComment] = useState(false);
@@ -127,11 +128,13 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => {
<blockquote className={`${styles.postMessage} ${!isReply && isMobile && styles.clampLines}`}> <blockquote className={`${styles.postMessage} ${!isReply && isMobile && styles.clampLines}`}>
{isReply && {isReply &&
!hasFailedState && !hasFailedState &&
!(deleted || removed) && !(deleted || removed || purged) &&
(filteredQuotedCids.length > 0 (filteredQuotedCids.length > 0
? filteredQuotedCids.map((cid: string) => <QuotedCidLink key={cid} cid={cid} postCid={postCid} />) ? filteredQuotedCids.map((cid: string) => <QuotedCidLink key={cid} cid={cid} postCid={postCid} />)
: shouldShowReplyingToReply && <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={quotelinkReply} quotelinkNumber={parentNumber} />)} : shouldShowReplyingToReply && <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={quotelinkReply} quotelinkNumber={parentNumber} />)}
{removed ? ( {purged ? (
<span className={styles.redEditMessage}>{capitalize(t('this_post_was_purged'))}</span>
) : removed ? (
reason ? ( reason ? (
<> <>
<span className={styles.redEditMessage}>({t('this_post_was_removed')})</span> <span className={styles.redEditMessage}>({t('this_post_was_removed')})</span>
+17 -2
View File
@@ -20,13 +20,26 @@ interface MediaProps {
linkHeight?: number; linkHeight?: number;
linkWidth?: number; linkWidth?: number;
parentCid?: string; parentCid?: string;
purged?: boolean;
removed?: boolean; removed?: boolean;
spoiler?: boolean; spoiler?: boolean;
showThumbnail?: boolean; showThumbnail?: boolean;
setShowThumbnail: (showThumbnail: boolean) => void; setShowThumbnail: (showThumbnail: boolean) => void;
} }
const Thumbnail = ({ commentMediaInfo, deleted, displayHeight, displayWidth, isFloatingEmbed, isOutOfFeed, isReply, removed, spoiler, setShowThumbnail }: MediaProps) => { const Thumbnail = ({
commentMediaInfo,
deleted,
displayHeight,
displayWidth,
isFloatingEmbed,
isOutOfFeed,
isReply,
purged,
removed,
spoiler,
setShowThumbnail,
}: MediaProps) => {
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const { patternThumbnailUrl, thumbnail, type, url } = commentMediaInfo || {}; const { patternThumbnailUrl, thumbnail, type, url } = commentMediaInfo || {};
@@ -133,7 +146,7 @@ const Thumbnail = ({ commentMediaInfo, deleted, displayHeight, displayWidth, isF
) )
) : null; ) : null;
return deleted || removed ? ( return deleted || removed || purged ? (
<img className={styles.fileDeleted} src='assets/filedeleted-res.gif' alt='File deleted' /> <img className={styles.fileDeleted} src='assets/filedeleted-res.gif' alt='File deleted' />
) : spoiler ? ( ) : spoiler ? (
<img <img
@@ -381,6 +394,7 @@ const CommentMedia = ({
linkHeight, linkHeight,
linkWidth, linkWidth,
parentCid, parentCid,
purged,
removed, removed,
showThumbnail, showThumbnail,
setShowThumbnail, setShowThumbnail,
@@ -450,6 +464,7 @@ const CommentMedia = ({
isFloatingEmbed={isFloatingEmbed} isFloatingEmbed={isFloatingEmbed}
isOutOfFeed={isOutOfFeed} isOutOfFeed={isOutOfFeed}
deleted={deleted} deleted={deleted}
purged={purged}
removed={removed} removed={removed}
spoiler={spoiler} spoiler={spoiler}
setShowThumbnail={setShowThumbnail} setShowThumbnail={setShowThumbnail}
+22 -10
View File
@@ -93,6 +93,7 @@ const PostInfo = ({
}: PostProps & { directRepliesByParentCid?: Map<string, Comment[]> }) => { }: PostProps & { directRepliesByParentCid?: Map<string, Comment[]> }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { author, cid, deleted, locked, pinned, parentCid, postCid, reason, removed, state, subplebbitAddress, timestamp } = post || {}; const { author, cid, deleted, locked, pinned, parentCid, postCid, reason, removed, state, subplebbitAddress, timestamp } = post || {};
const purged = post?.commentModeration?.purged;
const title = post?.title?.trim(); const title = post?.title?.trim();
const { address, shortAddress } = author || {}; const { address, shortAddress } = author || {};
const displayName = author?.displayName?.trim(); const displayName = author?.displayName?.trim();
@@ -222,7 +223,7 @@ const PostInfo = ({
const handleUserAddressClick = useAuthorAddressClick(); const handleUserAddressClick = useAuthorAddressClick();
const numberOfPostsByAuthor = (() => { const numberOfPostsByAuthor = (() => {
if (!showUserID || deleted || removed || !shortAddress || !postCid || typeof document === 'undefined') { if (!showUserID || deleted || removed || purged || !shortAddress || !postCid || typeof document === 'undefined') {
return 0; return 0;
} }
@@ -239,7 +240,7 @@ const PostInfo = ({
? isReply ? isReply
? alert(t('this_reply_was_deleted')) ? alert(t('this_reply_was_deleted'))
: alert(t('this_thread_was_deleted')) : alert(t('this_thread_was_deleted'))
: removed : removed || purged
? isReply ? isReply
? alert(t('this_reply_was_removed')) ? alert(t('this_reply_was_removed'))
: alert(t('this_thread_was_removed')) : alert(t('this_thread_was_removed'))
@@ -266,7 +267,7 @@ const PostInfo = ({
return ( return (
<div className={styles.postInfo}> <div className={styles.postInfo}>
{isHidden ? parentCid && <span className={styles.hiddenReplyEditMenuSpacer} /> : <EditMenu post={post} />} {isHidden ? parentCid && <span className={styles.hiddenReplyEditMenuSpacer} /> : <EditMenu post={post} />}
<span className={(hidden || ((removed || deleted) && !reason)) && parentCid ? styles.postDesktopHidden : ''}> <span className={(hidden || ((removed || deleted || purged) && !reason)) && parentCid ? styles.postDesktopHidden : ''}>
{title && {title &&
(title.length <= 75 ? ( (title.length <= 75 ? (
<span className={styles.subject}>{title} </span> <span className={styles.subject}>{title} </span>
@@ -276,11 +277,13 @@ const PostInfo = ({
</Tooltip> </Tooltip>
))} ))}
<span className={styles.nameBlock}> <span className={styles.nameBlock}>
<span className={`${styles.name} ${authorRole && !(deleted || removed) && (authorRole === 'mod' ? styles.capcodeMod : styles.capcodeAdmin)}`}> <span className={`${styles.name} ${authorRole && !(deleted || removed || purged) && (authorRole === 'mod' ? styles.capcodeMod : styles.capcodeAdmin)}`}>
{deleted ? ( {deleted ? (
capitalize(t('deleted')) capitalize(t('deleted'))
) : removed ? ( ) : removed ? (
capitalize(t('removed')) capitalize(t('removed'))
) : purged ? (
capitalize(t('purged'))
) : displayName ? ( ) : displayName ? (
displayName.length <= 20 ? ( displayName.length <= 20 ? (
displayName displayName
@@ -292,7 +295,7 @@ const PostInfo = ({
) : ( ) : (
capitalize(t('anonymous')) capitalize(t('anonymous'))
)} )}
{!(deleted || removed) && authorRole && ( {!(deleted || removed || purged) && authorRole && (
<span className='capitalize'> <span className='capitalize'>
{' '} {' '}
## Board {authorRole}{' '} ## Board {authorRole}{' '}
@@ -310,6 +313,8 @@ const PostInfo = ({
t('deleted') t('deleted')
) : removed ? ( ) : removed ? (
t('removed') t('removed')
) : purged ? (
t('purged')
) : !cid && pseudonymityMode ? ( ) : !cid && pseudonymityMode ? (
<span className={styles.pendingCid}>{hasFailedState ? capitalize(t('failed')) : capitalize(t('pending'))}</span> <span className={styles.pendingCid}>{hasFailedState ? capitalize(t('failed')) : capitalize(t('pending'))}</span>
) : ( ) : (
@@ -481,7 +486,7 @@ const PostInfo = ({
</span> </span>
)} )}
</span> </span>
{!(removed || deleted) && !isModQueue && <PostMenuDesktop postMenu={postMenuProps} />} {!(removed || deleted || purged) && !isModQueue && <PostMenuDesktop postMenu={postMenuProps} />}
{cid && parentCid && <ReplyBacklinks post={post} quotedByMap={quotedByMap} directRepliesByParentCid={directRepliesByParentCid} />} {cid && parentCid && <ReplyBacklinks post={post} quotedByMap={quotedByMap} directRepliesByParentCid={directRepliesByParentCid} />}
{cid && !parentCid && <OpBacklinks cid={cid} quotedByMap={quotedByMap} />} {cid && !parentCid && <OpBacklinks cid={cid} quotedByMap={quotedByMap} />}
</span> </span>
@@ -544,6 +549,7 @@ interface PostMediaProps {
hasThumbnail: boolean; hasThumbnail: boolean;
spoiler: boolean; spoiler: boolean;
deleted: boolean; deleted: boolean;
purged: boolean;
removed: boolean; removed: boolean;
linkHeight: number; linkHeight: number;
linkWidth: number; linkWidth: number;
@@ -559,6 +565,7 @@ const PostMedia = ({
hasThumbnail, hasThumbnail,
spoiler, spoiler,
deleted, deleted,
purged,
removed, removed,
linkHeight, linkHeight,
linkWidth, linkWidth,
@@ -663,6 +670,7 @@ const PostMedia = ({
<CommentMedia <CommentMedia
commentMediaInfo={commentMediaInfo} commentMediaInfo={commentMediaInfo}
deleted={deleted} deleted={deleted}
purged={purged}
removed={removed} removed={removed}
linkHeight={linkHeight} linkHeight={linkHeight}
linkWidth={linkWidth} linkWidth={linkWidth}
@@ -697,6 +705,7 @@ const Reply = ({
} }
const { author, cid, deleted, link, linkHeight, linkWidth, postCid, reason, removed, spoiler, subplebbitAddress, thumbnailUrl, parentCid } = post || {}; const { author, cid, deleted, link, linkHeight, linkWidth, postCid, reason, removed, spoiler, subplebbitAddress, thumbnailUrl, parentCid } = post || {};
const purged = post?.commentModeration?.purged;
const directories = useDirectories(); const directories = useDirectories();
const boardPath = subplebbitAddress ? getBoardPath(subplebbitAddress, directories) : undefined; const boardPath = subplebbitAddress ? getBoardPath(subplebbitAddress, directories) : undefined;
@@ -726,12 +735,13 @@ const Reply = ({
quotedByMap={quotedByMap} quotedByMap={quotedByMap}
directRepliesByParentCid={directRepliesByParentCid} directRepliesByParentCid={directRepliesByParentCid}
/> />
{link && !hidden && !(deleted || removed) && isValidURL(link) && ( {link && !hidden && !(deleted || removed || purged) && isValidURL(link) && (
<PostMedia <PostMedia
commentMediaInfo={commentMediaInfo} commentMediaInfo={commentMediaInfo}
hasThumbnail={hasThumbnail} hasThumbnail={hasThumbnail}
spoiler={spoiler} spoiler={spoiler}
deleted={deleted} deleted={deleted}
purged={!!purged}
removed={removed} removed={removed}
linkHeight={linkHeight} linkHeight={linkHeight}
linkWidth={linkWidth} linkWidth={linkWidth}
@@ -742,7 +752,7 @@ const Reply = ({
isInModView={isInModView} isInModView={isInModView}
/> />
)} )}
{!hidden && (!(removed || deleted) || ((removed || deleted) && reason)) && <CommentContent comment={post} />} {!hidden && (!(removed || deleted || purged) || ((removed || deleted) && reason)) && <CommentContent comment={post} />}
</div> </div>
</div> </div>
); );
@@ -763,6 +773,7 @@ const PostDesktop = ({
}: PostProps) => { }: PostProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { author, cid, content, deleted, link, linkHeight, linkWidth, pinned, postCid, removed, spoiler, state, subplebbitAddress, thumbnailUrl, parentCid } = post || {}; const { author, cid, content, deleted, link, linkHeight, linkWidth, pinned, postCid, removed, spoiler, state, subplebbitAddress, thumbnailUrl, parentCid } = post || {};
const purged = post?.commentModeration?.purged;
const params = useParams(); const params = useParams();
const location = useLocation(); const location = useLocation();
const navigationType = useNavigationType(); const navigationType = useNavigationType();
@@ -969,12 +980,13 @@ const PostDesktop = ({
</div> </div>
</div> </div>
)} )}
{link && !isHidden && !(deleted || removed) && isValidURL(link) && ( {link && !isHidden && !(deleted || removed || purged) && isValidURL(link) && (
<PostMedia <PostMedia
commentMediaInfo={commentMediaInfo} commentMediaInfo={commentMediaInfo}
hasThumbnail={hasThumbnail} hasThumbnail={hasThumbnail}
spoiler={spoiler} spoiler={spoiler}
deleted={deleted} deleted={deleted}
purged={!!purged}
removed={removed} removed={removed}
linkHeight={linkHeight} linkHeight={linkHeight}
linkWidth={linkWidth} linkWidth={linkWidth}
@@ -1000,7 +1012,7 @@ const PostDesktop = ({
quotedByMap={quotedByMap} quotedByMap={quotedByMap}
directRepliesByParentCid={directRepliesByParentCid} directRepliesByParentCid={directRepliesByParentCid}
/> />
{!isHidden && !content && !(deleted || removed) && <div className={styles.spacer} />} {!isHidden && !content && !(deleted || removed || purged) && <div className={styles.spacer} />}
{!isHidden && <CommentContent comment={post} />} {!isHidden && <CommentContent comment={post} />}
</div> </div>
{!isHidden && !isInPendingPostView && showReplies && repliesCount > 0 && !isInPostPageView && ( {!isHidden && !isInPendingPostView && showReplies && repliesCount > 0 && !isInPostPageView && (
+14 -6
View File
@@ -59,6 +59,7 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos
const directories = useDirectories(); const directories = useDirectories();
const { author, cid, deleted, link, linkHeight, linkWidth, locked, parentCid, pinned, postCid, reason, removed, state, subplebbitAddress, timestamp, thumbnailUrl } = const { author, cid, deleted, link, linkHeight, linkWidth, locked, parentCid, pinned, postCid, reason, removed, state, subplebbitAddress, timestamp, thumbnailUrl } =
post || {}; post || {};
const purged = post?.commentModeration?.purged;
const boardPath = subplebbitAddress ? getBoardPath(subplebbitAddress, directories) : undefined; const boardPath = subplebbitAddress ? getBoardPath(subplebbitAddress, directories) : undefined;
const displayBoardPath = const displayBoardPath =
boardPath && subplebbitAddress boardPath && subplebbitAddress
@@ -217,7 +218,7 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos
? isReply ? isReply
? alert(t('this_reply_was_deleted')) ? alert(t('this_reply_was_deleted'))
: alert(t('this_thread_was_deleted')) : alert(t('this_thread_was_deleted'))
: removed : removed || purged
? isReply ? isReply
? alert(t('this_reply_was_removed')) ? alert(t('this_reply_was_removed'))
: alert(t('this_thread_was_removed')) : alert(t('this_thread_was_removed'))
@@ -246,13 +247,15 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos
<> <>
<div className={styles.postInfo}> <div className={styles.postInfo}>
<PostMenuMobile postMenu={postMenuProps} editMenuPost={post} /> <PostMenuMobile postMenu={postMenuProps} editMenuPost={post} />
<span className={(hidden || ((removed || deleted) && !reason)) && parentCid ? styles.postDesktopHidden : ''}> <span className={(hidden || ((removed || deleted || purged) && !reason)) && parentCid ? styles.postDesktopHidden : ''}>
<span className={styles.nameBlock}> <span className={styles.nameBlock}>
<span className={`${styles.name} ${authorRole && !(deleted || removed) && (authorRole === 'mod' ? styles.capcodeMod : styles.capcodeAdmin)}`}> <span className={`${styles.name} ${authorRole && !(deleted || removed || purged) && (authorRole === 'mod' ? styles.capcodeMod : styles.capcodeAdmin)}`}>
{removed ? ( {removed ? (
capitalize(t('removed')) capitalize(t('removed'))
) : deleted ? ( ) : deleted ? (
capitalize(t('deleted')) capitalize(t('deleted'))
) : purged ? (
capitalize(t('purged'))
) : displayName ? ( ) : displayName ? (
displayName.length <= 20 ? ( displayName.length <= 20 ? (
displayName displayName
@@ -264,7 +267,7 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos
) : ( ) : (
capitalize(t('anonymous')) capitalize(t('anonymous'))
)}{' '} )}{' '}
{!(deleted || removed) && authorRole && ( {!(deleted || removed || purged) && authorRole && (
<span className='capitalize'> <span className='capitalize'>
{' '} {' '}
## Board {authorRole}{' '} ## Board {authorRole}{' '}
@@ -285,6 +288,8 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos
lowerCase(t('removed')) lowerCase(t('removed'))
) : deleted ? ( ) : deleted ? (
lowerCase(t('deleted')) lowerCase(t('deleted'))
) : purged ? (
lowerCase(t('purged'))
) : !cid && pseudonymityMode ? ( ) : !cid && pseudonymityMode ? (
<span className={styles.pendingCid}>{hasFailedState ? capitalize(t('failed')) : capitalize(t('pending'))}</span> <span className={styles.pendingCid}>{hasFailedState ? capitalize(t('failed')) : capitalize(t('pending'))}</span>
) : ( ) : (
@@ -423,7 +428,7 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos
)} )}
</span> </span>
</div> </div>
{(hasThumbnail || link) && !(deleted || removed) && <PostMediaContent key={cid} post={post} link={link} />} {(hasThumbnail || link) && !(deleted || removed || purged) && <PostMediaContent key={cid} post={post} link={link} />}
</> </>
); );
}; };
@@ -431,6 +436,7 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos
const PostMediaContent = ({ post, link }: { post: any; link: string }) => { const PostMediaContent = ({ post, link }: { post: any; link: string }) => {
const [showThumbnail, setShowThumbnail] = useState(true); const [showThumbnail, setShowThumbnail] = useState(true);
const { thumbnailUrl, linkWidth, linkHeight, spoiler, deleted, removed, parentCid } = post || {}; const { thumbnailUrl, linkWidth, linkHeight, spoiler, deleted, removed, parentCid } = post || {};
const purged = post?.commentModeration?.purged;
const commentMediaInfo = useCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight); const commentMediaInfo = useCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight);
return ( return (
@@ -438,6 +444,7 @@ const PostMediaContent = ({ post, link }: { post: any; link: string }) => {
<CommentMedia <CommentMedia
commentMediaInfo={commentMediaInfo} commentMediaInfo={commentMediaInfo}
deleted={deleted} deleted={deleted}
purged={purged}
removed={removed} removed={removed}
linkHeight={linkHeight} linkHeight={linkHeight}
linkWidth={linkWidth} linkWidth={linkWidth}
@@ -519,6 +526,7 @@ const Reply = ({
post = editedComment; post = editedComment;
} }
const { author, cid, deleted, postCid, reason, removed, subplebbitAddress } = post || {}; const { author, cid, deleted, postCid, reason, removed, subplebbitAddress } = post || {};
const purged = post?.commentModeration?.purged;
const directories = useDirectories(); const directories = useDirectories();
const boardPath = subplebbitAddress ? getBoardPath(subplebbitAddress, directories) : undefined; const boardPath = subplebbitAddress ? getBoardPath(subplebbitAddress, directories) : undefined;
const location = useLocation(); const location = useLocation();
@@ -536,7 +544,7 @@ const Reply = ({
data-post-cid={postCid} data-post-cid={postCid}
> >
<PostInfoAndMedia post={post} postReplyCount={postReplyCount} roles={roles} threadNumber={threadNumber} /> <PostInfoAndMedia post={post} postReplyCount={postReplyCount} roles={roles} threadNumber={threadNumber} />
{!hidden && (!(removed || deleted) || ((removed || deleted) && reason)) && <CommentContent comment={post} />} {!hidden && (!(removed || deleted || purged) || ((removed || deleted) && reason)) && <CommentContent comment={post} />}
<ReplyBacklinks post={post} quotedByMap={quotedByMap} directRepliesByParentCid={directRepliesByParentCid} /> <ReplyBacklinks post={post} quotedByMap={quotedByMap} directRepliesByParentCid={directRepliesByParentCid} />
</div> </div>
</div> </div>
+1
View File
@@ -110,6 +110,7 @@ export const Post = memo(
prev?.pinned === next?.pinned && prev?.pinned === next?.pinned &&
prev?.removed === next?.removed && prev?.removed === next?.removed &&
prev?.deleted === next?.deleted && prev?.deleted === next?.deleted &&
prev?.commentModeration?.purged === next?.commentModeration?.purged &&
prevProps.showAllReplies === nextProps.showAllReplies && prevProps.showAllReplies === nextProps.showAllReplies &&
prevProps.showReplies === nextProps.showReplies && prevProps.showReplies === nextProps.showReplies &&
prevProps.targetReplyCid === nextProps.targetReplyCid && prevProps.targetReplyCid === nextProps.targetReplyCid &&