mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
move nsfw censor only for attachments
This commit is contained in:
parent
9b7edd87d1
commit
136424dacd
@ -1,5 +1,5 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Skeleton } from "antd"
|
import { Skeleton, Button } from "antd"
|
||||||
import { ImageViewer } from "components"
|
import { ImageViewer } from "components"
|
||||||
import Plyr from "plyr-react"
|
import Plyr from "plyr-react"
|
||||||
import mimetypes from "mime"
|
import mimetypes from "mime"
|
||||||
@ -130,6 +130,7 @@ const Attachment = React.memo((props) => {
|
|||||||
export default React.memo((props) => {
|
export default React.memo((props) => {
|
||||||
const [controller, setController] = React.useState()
|
const [controller, setController] = React.useState()
|
||||||
const [carouselState, setCarouselState] = React.useState()
|
const [carouselState, setCarouselState] = React.useState()
|
||||||
|
const [nsfwAccepted, setNsfwAccepted] = React.useState(false)
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
// get attachment index from query string
|
// get attachment index from query string
|
||||||
@ -141,6 +142,19 @@ export default React.memo((props) => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return <div className="post_attachments">
|
return <div className="post_attachments">
|
||||||
|
{
|
||||||
|
props.flags && props.flags.includes("nsfw") && !nsfwAccepted &&
|
||||||
|
<div className="nsfw_alert">
|
||||||
|
<h2>
|
||||||
|
This post may contain sensitive content.
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<Button onClick={() => setNsfwAccepted(true)}>
|
||||||
|
Show anyways
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
props.attachments?.length > 0 && <BearCarousel
|
props.attachments?.length > 0 && <BearCarousel
|
||||||
data={props.attachments.map((attachment, index) => {
|
data={props.attachments.map((attachment, index) => {
|
||||||
|
@ -178,19 +178,6 @@ export default class PostCard extends React.PureComponent {
|
|||||||
"post_content",
|
"post_content",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{
|
|
||||||
this.state.isNsfw && !this.state.nsfwAccepted &&
|
|
||||||
<div className="nsfw_alert">
|
|
||||||
<h2>
|
|
||||||
This post may contain sensitive content.
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<antd.Button onClick={() => this.setState({ nsfwAccepted: true })}>
|
|
||||||
Show anyways
|
|
||||||
</antd.Button>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
<div className="message">
|
<div className="message">
|
||||||
{
|
{
|
||||||
processString(messageRegexs)(this.props.data.message ?? "")
|
processString(messageRegexs)(this.props.data.message ?? "")
|
||||||
@ -200,8 +187,8 @@ export default class PostCard extends React.PureComponent {
|
|||||||
{
|
{
|
||||||
!this.props.disableAttachments && this.props.data.attachments && this.props.data.attachments.length > 0 && <PostAttachments
|
!this.props.disableAttachments && this.props.data.attachments && this.props.data.attachments.length > 0 && <PostAttachments
|
||||||
attachments={this.props.data.attachments}
|
attachments={this.props.data.attachments}
|
||||||
|
flags={this.props.data.flags}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user