feat(post): add 'user was banned for this post' if user was banned by board to post in it

This commit is contained in:
Tom (plebeius.eth)
2024-07-02 18:31:53 +02:00
parent 76fc1dd2f1
commit f6c1fb400b
37 changed files with 135 additions and 37 deletions
+15 -1
View File
@@ -217,7 +217,8 @@ const PostMedia = ({ post }: PostProps) => {
};
const PostMessage = ({ post }: PostProps) => {
const { cid, content, deleted, edit, original, parentCid, postCid, reason, removed, spoiler, state, subplebbitAddress } = post || {};
const { cid, content, commentAuthor, deleted, edit, original, parentCid, postCid, reason, removed, spoiler, state, subplebbitAddress } = post || {};
const banned = commentAuthor?.banExpiresAt;
const { t } = useTranslation();
const params = useParams();
const location = useLocation();
@@ -268,6 +269,19 @@ const PostMessage = ({ post }: PostProps) => {
)}
</span>
)}
{banned && (
<span className={styles.removedContent}>
<br />
<Tooltip
children={`(${t('user_banned')})`}
content={t('ban_expires_at', {
address: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress),
timestamp: getFormattedDate(commentAuthor?.banExpiresAt),
interpolation: { escapeValue: false },
})}
/>
</span>
)}
</>
)}
{(removed || deleted) && reason && (
+15 -1
View File
@@ -152,7 +152,8 @@ const ReplyBacklinks = ({ post }: PostProps) => {
const PostMessageMobile = ({ post }: PostProps) => {
const { t } = useTranslation();
const { cid, content, deleted, edit, original, parentCid, postCid, reason, removed, spoiler, state, subplebbitAddress } = post || {};
const { cid, commentAuthor, content, deleted, edit, original, parentCid, postCid, reason, removed, spoiler, state, subplebbitAddress } = post || {};
const banned = commentAuthor?.banExpiresAt;
const [showOriginal, setShowOriginal] = useState(false);
const params = useParams();
@@ -204,6 +205,19 @@ const PostMessageMobile = ({ post }: PostProps) => {
)}
</span>
)}
{banned && (
<span className={styles.removedContent}>
<br />
<Tooltip
children={`(${t('user_banned')})`}
content={t('ban_expires_at', {
address: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress),
timestamp: getFormattedDate(commentAuthor?.banExpiresAt),
interpolation: { escapeValue: false },
})}
/>
</span>
)}
</>
)}
{(removed || deleted) && reason && (