diff --git a/public/translations/ar/default.json b/public/translations/ar/default.json
index 71cd71a6..53384847 100644
--- a/public/translations/ar/default.json
+++ b/public/translations/ar/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "عتبة التنبيه",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/bn/default.json b/public/translations/bn/default.json
index dcca3f86..45625c5c 100644
--- a/public/translations/bn/default.json
+++ b/public/translations/bn/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "সতর্কতা থ্রেশহোল্ড",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/cs/default.json b/public/translations/cs/default.json
index 88b282ab..68185f25 100644
--- a/public/translations/cs/default.json
+++ b/public/translations/cs/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Práh upozornění",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/da/default.json b/public/translations/da/default.json
index 3f858add..61edc614 100644
--- a/public/translations/da/default.json
+++ b/public/translations/da/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Alarmtærskel",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/de/default.json b/public/translations/de/default.json
index 5dc5e378..da027f7d 100644
--- a/public/translations/de/default.json
+++ b/public/translations/de/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Alarmschwellenwert",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Typ",
+ "yes": "Ja",
+ "no": "Nein",
+ "pending_mod_approval": "Ausstehende Moderatorgenehmigung, für Benutzer nicht sichtbar"
}
diff --git a/public/translations/el/default.json b/public/translations/el/default.json
index f5658b56..5d26b491 100644
--- a/public/translations/el/default.json
+++ b/public/translations/el/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Όριο ειδοποίησης",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/en/default.json b/public/translations/en/default.json
index 78f5c28e..1bdb3f20 100644
--- a/public/translations/en/default.json
+++ b/public/translations/en/default.json
@@ -272,5 +272,9 @@
"approved": "Approved",
"rejected": "Rejected",
"submitted": "Submitted",
- "downloading_board": "Downloading board"
+ "downloading_board": "Downloading board",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/es/default.json b/public/translations/es/default.json
index 619021df..3070b92c 100644
--- a/public/translations/es/default.json
+++ b/public/translations/es/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Umbral de alerta",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Tipo",
+ "yes": "Sí",
+ "no": "No",
+ "pending_mod_approval": "Pendiente de aprobación del moderador, no visible para los usuarios"
}
diff --git a/public/translations/fa/default.json b/public/translations/fa/default.json
index 90c0836e..eee42a7d 100644
--- a/public/translations/fa/default.json
+++ b/public/translations/fa/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "آستانه هشدار",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/fi/default.json b/public/translations/fi/default.json
index 39a05080..8e3956b3 100644
--- a/public/translations/fi/default.json
+++ b/public/translations/fi/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Hälytyskynnys",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/fil/default.json b/public/translations/fil/default.json
index ab6c0d5f..b89351bc 100644
--- a/public/translations/fil/default.json
+++ b/public/translations/fil/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Alert threshold",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/fr/default.json b/public/translations/fr/default.json
index 183d1af6..3cae3b5a 100644
--- a/public/translations/fr/default.json
+++ b/public/translations/fr/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Seuil d'alerte",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Oui",
+ "no": "Non",
+ "pending_mod_approval": "En attente d'approbation du modérateur, non visible pour les utilisateurs"
}
diff --git a/public/translations/he/default.json b/public/translations/he/default.json
index fc3d917c..4daa7ecc 100644
--- a/public/translations/he/default.json
+++ b/public/translations/he/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "סף התרעה",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/hi/default.json b/public/translations/hi/default.json
index 03395dae..33e0904d 100644
--- a/public/translations/hi/default.json
+++ b/public/translations/hi/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "सतर्कता सीमा",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/hu/default.json b/public/translations/hu/default.json
index 7a3ec449..384675c9 100644
--- a/public/translations/hu/default.json
+++ b/public/translations/hu/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Riasztási küszöb",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/id/default.json b/public/translations/id/default.json
index e8697747..c5bd27ea 100644
--- a/public/translations/id/default.json
+++ b/public/translations/id/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Ambang peringatan",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/it/default.json b/public/translations/it/default.json
index 3ee2f207..459605ac 100644
--- a/public/translations/it/default.json
+++ b/public/translations/it/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Soglia di allerta",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Tipo",
+ "yes": "Sì",
+ "no": "No",
+ "pending_mod_approval": "In attesa di approvazione del moderatore, non visibile agli utenti"
}
diff --git a/public/translations/ja/default.json b/public/translations/ja/default.json
index 917bb4b8..11b28a9a 100644
--- a/public/translations/ja/default.json
+++ b/public/translations/ja/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "アラート閾値",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "タイプ",
+ "yes": "はい",
+ "no": "いいえ",
+ "pending_mod_approval": "モデレーターの承認待ち、ユーザーには表示されません"
}
diff --git a/public/translations/ko/default.json b/public/translations/ko/default.json
index e3157c3b..655a10aa 100644
--- a/public/translations/ko/default.json
+++ b/public/translations/ko/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "알림 임계값",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/mr/default.json b/public/translations/mr/default.json
index 02beacf5..a1b11e7d 100644
--- a/public/translations/mr/default.json
+++ b/public/translations/mr/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "सतर्कता मर्यादा",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/nl/default.json b/public/translations/nl/default.json
index 8cf7e2ad..23b652dc 100644
--- a/public/translations/nl/default.json
+++ b/public/translations/nl/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Drempelwaarde voor waarschuwing",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/no/default.json b/public/translations/no/default.json
index c4171f0b..8e6ec069 100644
--- a/public/translations/no/default.json
+++ b/public/translations/no/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Terskel for varsel",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/pl/default.json b/public/translations/pl/default.json
index 780f71f5..05ab8909 100644
--- a/public/translations/pl/default.json
+++ b/public/translations/pl/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Próg alertu",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/pt/default.json b/public/translations/pt/default.json
index 16dcbde8..a0f5eb06 100644
--- a/public/translations/pt/default.json
+++ b/public/translations/pt/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Limite de alerta",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Tipo",
+ "yes": "Sim",
+ "no": "Não",
+ "pending_mod_approval": "Aguardando aprovação do moderador, não visível para os usuários"
}
diff --git a/public/translations/ro/default.json b/public/translations/ro/default.json
index 4525740a..f69b3e7c 100644
--- a/public/translations/ro/default.json
+++ b/public/translations/ro/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Prag de alertă",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/ru/default.json b/public/translations/ru/default.json
index 5eb28ec0..8b4d4ad5 100644
--- a/public/translations/ru/default.json
+++ b/public/translations/ru/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Порог предупреждения",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Тип",
+ "yes": "Да",
+ "no": "Нет",
+ "pending_mod_approval": "Ожидает одобрения модератора, не видно пользователям"
}
diff --git a/public/translations/sq/default.json b/public/translations/sq/default.json
index 02ecec76..a113ed56 100644
--- a/public/translations/sq/default.json
+++ b/public/translations/sq/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Pragu i alarmit",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/sv/default.json b/public/translations/sv/default.json
index 95fef456..7d82db67 100644
--- a/public/translations/sv/default.json
+++ b/public/translations/sv/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Tröskelvärde för varning",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/te/default.json b/public/translations/te/default.json
index 6e43a067..e7b546a8 100644
--- a/public/translations/te/default.json
+++ b/public/translations/te/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "హెచ్చరిక థ్రెషోల్డ్",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/th/default.json b/public/translations/th/default.json
index ca3e3dff..a9748681 100644
--- a/public/translations/th/default.json
+++ b/public/translations/th/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "เกณฑ์การแจ้งเตือน",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/tr/default.json b/public/translations/tr/default.json
index b3f675b4..778daa1b 100644
--- a/public/translations/tr/default.json
+++ b/public/translations/tr/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Uyarı eşiği",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/uk/default.json b/public/translations/uk/default.json
index 7089e305..e0d3169e 100644
--- a/public/translations/uk/default.json
+++ b/public/translations/uk/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Поріг попередження",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/ur/default.json b/public/translations/ur/default.json
index bd63e860..ef6384c1 100644
--- a/public/translations/ur/default.json
+++ b/public/translations/ur/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "انتباہ کی حد",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/vi/default.json b/public/translations/vi/default.json
index b9ea62d3..c4e450d2 100644
--- a/public/translations/vi/default.json
+++ b/public/translations/vi/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "Ngưỡng cảnh báo",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "Type",
+ "yes": "Yes",
+ "no": "No",
+ "pending_mod_approval": "Pending mod approval, not visible to users"
}
diff --git a/public/translations/zh/default.json b/public/translations/zh/default.json
index 64825a5e..784eb8ee 100644
--- a/public/translations/zh/default.json
+++ b/public/translations/zh/default.json
@@ -272,5 +272,9 @@
"alert_threshold": "警报阈值",
"modQueue.viewLabel": "View",
"modQueue.compact": "Compact",
- "modQueue.feed": "Feed"
+ "modQueue.feed": "Feed",
+ "type": "类型",
+ "yes": "是",
+ "no": "否",
+ "pending_mod_approval": "等待版主批准,用户不可见"
}
diff --git a/src/components/comment-content/comment-content.tsx b/src/components/comment-content/comment-content.tsx
index 5a530620..10fb4700 100644
--- a/src/components/comment-content/comment-content.tsx
+++ b/src/components/comment-content/comment-content.tsx
@@ -76,7 +76,7 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => {
{pendingApproval && (
<>
- (Pending mod approval, not visible to users)
+ ({t('pending_mod_approval')})
>
)}
{((!isInPostView && content?.length > 1000 && !showFullComment) || (isInPostView && content?.length > 2000 && !showFullComment)) && (
diff --git a/src/components/post-desktop/post-desktop.tsx b/src/components/post-desktop/post-desktop.tsx
index 7f3fd0f8..166d60ac 100644
--- a/src/components/post-desktop/post-desktop.tsx
+++ b/src/components/post-desktop/post-desktop.tsx
@@ -1,8 +1,8 @@
-import { useEffect, useMemo, useRef, useState } from 'react';
+import { useEffect, useMemo, useRef, useState, useCallback } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { Link, useLocation, useNavigationType, useParams } from 'react-router-dom';
import { Virtuoso, VirtuosoHandle, StateSnapshot } from 'react-virtuoso';
-import { Comment, useAuthorAvatar, useEditedComment, useReplies } from '@plebbit/plebbit-react-hooks';
+import { Comment, useAuthorAvatar, useEditedComment, useReplies, useAccount } from '@plebbit/plebbit-react-hooks';
import Plebbit from '@plebbit/plebbit-js';
import styles from '../../views/post/post.module.css';
import { CommentMediaInfo, getDisplayMediaInfoType, getHasThumbnail, getMediaDimensions } from '../../lib/utils/media-utils';
@@ -35,6 +35,11 @@ import _ from 'lodash';
import { shouldShowSnow } from '../../lib/snow';
import useReplyModalStore from '../../stores/use-reply-modal-store';
import { selectPostMenuProps } from '../../lib/utils/post-menu-props';
+import useChallengesStore from '../../stores/use-challenges-store';
+import { alertChallengeVerificationFailed } from '../../lib/utils/challenge-utils';
+import { usePublishCommentModeration } from '@plebbit/plebbit-react-hooks';
+
+const { addChallenge } = useChallengesStore.getState();
// Store scroll position for replies virtuoso across navigations
const lastVirtuosoStates: { [key: string]: StateSnapshot } = {};
@@ -89,6 +94,97 @@ const PostInfo = ({
const isInPostPageView = isPostPageView(location.pathname, params);
const isInModQueueView = isModQueueView(location.pathname);
const { getAlertThresholdSeconds } = useModQueueStore();
+ const account = useAccount();
+ const accountAddress = account?.author?.address;
+
+ // Check if user is mod of this board
+ const accountRole = roles?.[accountAddress]?.role;
+ const isAccountMod = accountRole === 'admin' || accountRole === 'owner' || accountRole === 'moderator';
+
+ // Check if post is pending approval and user is mod (for post page view)
+ const pendingApproval = post?.pendingApproval;
+ const shouldShowPendingApprovalButtons = isInPostPageView && !isInModQueueView && pendingApproval && isAccountMod && subplebbitAddress;
+
+ // Moderation actions for pending approval posts
+ const {
+ publishCommentModeration: approvePending,
+ state: approvePendingState,
+ error: approvePendingError,
+ } = usePublishCommentModeration({
+ commentCid: cid,
+ subplebbitAddress: shouldShowPendingApprovalButtons ? subplebbitAddress : undefined,
+ commentModeration: { approved: true },
+ onChallenge: async (...args: any) => {
+ addChallenge([...args, post]);
+ },
+ onChallengeVerification: async (challengeVerification, comment) => {
+ alertChallengeVerificationFailed(challengeVerification, comment);
+ },
+ onError: (error: Error) => {
+ console.error('Approve failed:', error);
+ },
+ });
+
+ const {
+ publishCommentModeration: rejectPending,
+ state: rejectPendingState,
+ error: rejectPendingError,
+ } = usePublishCommentModeration({
+ commentCid: cid,
+ subplebbitAddress: shouldShowPendingApprovalButtons ? subplebbitAddress : undefined,
+ commentModeration: { removed: true },
+ onChallenge: async (...args: any) => {
+ addChallenge([...args, post]);
+ },
+ onChallengeVerification: async (challengeVerification, comment) => {
+ alertChallengeVerificationFailed(challengeVerification, comment);
+ },
+ onError: (error: Error) => {
+ console.error('Reject failed:', error);
+ },
+ });
+
+ const [initiatedPendingAction, setInitiatedPendingAction] = useState<'approve' | 'reject' | null>(null);
+
+ const handlePendingApprove = useCallback(async () => {
+ const confirm = window.confirm(t('double_confirm'));
+ if (!confirm) {
+ return;
+ }
+ setInitiatedPendingAction('approve');
+ try {
+ await approvePending();
+ } catch (e) {
+ console.error(e);
+ }
+ }, [approvePending, t]);
+
+ const handlePendingReject = useCallback(async () => {
+ const confirm = window.confirm(t('double_confirm'));
+ if (!confirm) {
+ return;
+ }
+ setInitiatedPendingAction('reject');
+ try {
+ await rejectPending();
+ } catch (e) {
+ console.error(e);
+ }
+ }, [rejectPending, t]);
+
+ const isApprovingPending =
+ initiatedPendingAction === 'approve' && approvePendingState !== 'initializing' && approvePendingState !== 'succeeded' && approvePendingState !== 'failed';
+ const isRejectingPending =
+ initiatedPendingAction === 'reject' && rejectPendingState !== 'initializing' && rejectPendingState !== 'succeeded' && rejectPendingState !== 'failed';
+ const isPublishingPending = isApprovingPending || isRejectingPending;
+
+ const approvePendingSucceeded = initiatedPendingAction === 'approve' && approvePendingState === 'succeeded';
+ const rejectPendingSucceeded = initiatedPendingAction === 'reject' && rejectPendingState === 'succeeded';
+ const approvePendingFailed = initiatedPendingAction === 'approve' && approvePendingState === 'failed';
+ const rejectPendingFailed = initiatedPendingAction === 'reject' && rejectPendingState === 'failed';
+
+ const pendingStatus = approvePendingSucceeded ? 'approved' : rejectPendingSucceeded ? 'rejected' : approvePendingFailed || rejectPendingFailed ? 'failed' : null;
+ const pendingErrorMessage = approvePendingFailed ? approvePendingError?.message : rejectPendingFailed ? rejectPendingError?.message : undefined;
// Check if post is awaiting approval and over threshold (for mod queue view)
const approved = post?.approved;
@@ -277,6 +373,39 @@ const PostInfo = ({
)}
)}
+ {shouldShowPendingApprovalButtons && (
+
+ {pendingStatus === 'approved' ? (
+ {t('approved')}
+ ) : pendingStatus === 'rejected' ? (
+ {t('rejected')}
+ ) : pendingStatus === 'failed' ? (
+
+ {t('failed')}
+ {pendingErrorMessage ? `: ${pendingErrorMessage}` : ''}
+
+ ) : isPublishingPending ? (
+