Fix: only show appeal CW item on moderated posts (#2312)
* Fix: only show appeal CW item on moderated posts * Add appeal cw control to feed view o fpostszio/stable
parent
6e001dbf1c
commit
0c9dc2163a
|
@ -186,9 +186,9 @@ let PostThreadItemLoaded = ({
|
||||||
return makeProfileLink(post.author, 'post', urip.rkey, 'reposted-by')
|
return makeProfileLink(post.author, 'post', urip.rkey, 'reposted-by')
|
||||||
}, [post.uri, post.author])
|
}, [post.uri, post.author])
|
||||||
const repostsTitle = 'Reposts of this post'
|
const repostsTitle = 'Reposts of this post'
|
||||||
const isSelfLabeledPost =
|
const isModeratedPost =
|
||||||
moderation.decisions.post.cause?.type === 'label' &&
|
moderation.decisions.post.cause?.type === 'label' &&
|
||||||
moderation.decisions.post.cause.label.src === currentAccount?.did
|
moderation.decisions.post.cause.label.src !== currentAccount?.did
|
||||||
|
|
||||||
const translatorUrl = getTranslatorLink(
|
const translatorUrl = getTranslatorLink(
|
||||||
record?.text || '',
|
record?.text || '',
|
||||||
|
@ -335,7 +335,7 @@ let PostThreadItemLoaded = ({
|
||||||
postUri={post.uri}
|
postUri={post.uri}
|
||||||
record={record}
|
record={record}
|
||||||
showAppealLabelItem={
|
showAppealLabelItem={
|
||||||
post.author.did === currentAccount?.did && !isSelfLabeledPost
|
post.author.did === currentAccount?.did && isModeratedPost
|
||||||
}
|
}
|
||||||
style={{
|
style={{
|
||||||
paddingVertical: 6,
|
paddingVertical: 6,
|
||||||
|
|
|
@ -34,6 +34,7 @@ import {countLines} from 'lib/strings/helpers'
|
||||||
import {useComposerControls} from '#/state/shell/composer'
|
import {useComposerControls} from '#/state/shell/composer'
|
||||||
import {Shadow, usePostShadow, POST_TOMBSTONE} from '#/state/cache/post-shadow'
|
import {Shadow, usePostShadow, POST_TOMBSTONE} from '#/state/cache/post-shadow'
|
||||||
import {FeedNameText} from '../util/FeedInfoText'
|
import {FeedNameText} from '../util/FeedInfoText'
|
||||||
|
import {useSession} from '#/state/session'
|
||||||
|
|
||||||
export function FeedItem({
|
export function FeedItem({
|
||||||
post,
|
post,
|
||||||
|
@ -102,10 +103,14 @@ let FeedItemInner = ({
|
||||||
}): React.ReactNode => {
|
}): React.ReactNode => {
|
||||||
const {openComposer} = useComposerControls()
|
const {openComposer} = useComposerControls()
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
|
const {currentAccount} = useSession()
|
||||||
const href = useMemo(() => {
|
const href = useMemo(() => {
|
||||||
const urip = new AtUri(post.uri)
|
const urip = new AtUri(post.uri)
|
||||||
return makeProfileLink(post.author, 'post', urip.rkey)
|
return makeProfileLink(post.author, 'post', urip.rkey)
|
||||||
}, [post.uri, post.author])
|
}, [post.uri, post.author])
|
||||||
|
const isModeratedPost =
|
||||||
|
moderation.decisions.post.cause?.type === 'label' &&
|
||||||
|
moderation.decisions.post.cause.label.src !== currentAccount?.did
|
||||||
|
|
||||||
const replyAuthorDid = useMemo(() => {
|
const replyAuthorDid = useMemo(() => {
|
||||||
if (!record?.reply) {
|
if (!record?.reply) {
|
||||||
|
@ -284,7 +289,14 @@ let FeedItemInner = ({
|
||||||
postEmbed={post.embed}
|
postEmbed={post.embed}
|
||||||
postAuthor={post.author}
|
postAuthor={post.author}
|
||||||
/>
|
/>
|
||||||
<PostCtrls post={post} record={record} onPressReply={onPressReply} />
|
<PostCtrls
|
||||||
|
post={post}
|
||||||
|
record={record}
|
||||||
|
onPressReply={onPressReply}
|
||||||
|
showAppealLabelItem={
|
||||||
|
post.author.did === currentAccount?.did && isModeratedPost
|
||||||
|
}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -31,12 +31,14 @@ let PostCtrls = ({
|
||||||
big,
|
big,
|
||||||
post,
|
post,
|
||||||
record,
|
record,
|
||||||
|
showAppealLabelItem,
|
||||||
style,
|
style,
|
||||||
onPressReply,
|
onPressReply,
|
||||||
}: {
|
}: {
|
||||||
big?: boolean
|
big?: boolean
|
||||||
post: Shadow<AppBskyFeedDefs.PostView>
|
post: Shadow<AppBskyFeedDefs.PostView>
|
||||||
record: AppBskyFeedPost.Record
|
record: AppBskyFeedPost.Record
|
||||||
|
showAppealLabelItem?: boolean
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
onPressReply: () => void
|
onPressReply: () => void
|
||||||
}): React.ReactNode => {
|
}): React.ReactNode => {
|
||||||
|
@ -207,6 +209,7 @@ let PostCtrls = ({
|
||||||
postCid={post.cid}
|
postCid={post.cid}
|
||||||
postUri={post.uri}
|
postUri={post.uri}
|
||||||
record={record}
|
record={record}
|
||||||
|
showAppealLabelItem={showAppealLabelItem}
|
||||||
style={styles.ctrlPad}
|
style={styles.ctrlPad}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in New Issue