feat(post): show pending approval reason

This commit is contained in:
Tommaso Casaburi
2026-05-24 17:06:03 +07:00
parent 0df81b598e
commit 348e3393c7
37 changed files with 87 additions and 35 deletions
@@ -69,6 +69,9 @@ vi.mock('react-i18next', () => ({
if (key === 'reason_reason') {
return `reason:${options?.reason}`;
}
if (key === 'pending_mod_approval_reason') {
return `pending-reason:${options?.reason}`;
}
if (key === 'ban_expires_at') {
return `ban:${options?.address}:${options?.timestamp}`;
}
@@ -473,6 +476,7 @@ describe('CommentContent', () => {
});
expect(container.textContent).toContain('pending_mod_approval');
expect(container.textContent).toContain('pending-reason:rules violation');
const tooltip = container.querySelector('[data-testid="tooltip"]');
expect(tooltip?.getAttribute('title')).toContain('ban:short:music-posting.eth:2024-01-01 12:00:00');
@@ -156,6 +156,7 @@ const CommentContent = ({
const failedError = getFailedCommentError(resolvedPost);
const failedErrorMessage = formatErrorMessageForDisplay(failedError);
const shouldShowUnpublishedStateDetails = !cid && (!hasFailedState || Boolean(failedError));
const pendingApprovalReason = pendingApproval ? reason?.trim() : undefined;
const loadingString = (
<div className={styles.stateString}>
@@ -219,6 +220,18 @@ const CommentContent = ({
<br />
<br />
<span className={styles.pendingApproval}>({t('pending_mod_approval')})</span>
{pendingApprovalReason && (
<>
<br />
<br />
<span className={styles.grayEditMessage}>
{t('pending_mod_approval_reason', {
reason: pendingApprovalReason,
interpolation: { escapeValue: false },
})}
</span>
</>
)}
</>
)}
{((!isInPostView && content?.length > 1000 && !showFullComment) || (isInPostView && content?.length > 2000 && !showFullComment)) && (