Hide post for me
This commit is contained in:
@@ -302,13 +302,15 @@ let PostDropdownBtn = ({
|
|||||||
}
|
}
|
||||||
}, [_, quoteEmbed, post, toggleQuoteDetachment])
|
}, [_, quoteEmbed, post, toggleQuoteDetachment])
|
||||||
|
|
||||||
|
const canHidePostForMe = !isAuthor && !isPostHidden
|
||||||
const canEmbed = isWeb && gtMobile && !hideInPWI
|
const canEmbed = isWeb && gtMobile && !hideInPWI
|
||||||
const canHideReply = !isAuthor && isRootPostAuthor && !isPostHidden && isReply
|
const canHideReplyForEveryone =
|
||||||
|
!isAuthor && isRootPostAuthor && !isPostHidden && isReply
|
||||||
const canDetachQuote = quoteEmbed && quoteEmbed.isOwnedByViewer
|
const canDetachQuote = quoteEmbed && quoteEmbed.isOwnedByViewer
|
||||||
|
|
||||||
const onToggleReplyVisibility = React.useCallback(async () => {
|
const onToggleReplyVisibility = React.useCallback(async () => {
|
||||||
// TODO no threadgate?
|
// TODO no threadgate?
|
||||||
if (!canHideReply) return
|
if (!canHideReplyForEveryone) return
|
||||||
|
|
||||||
const action = isReplyHiddenByThreadgate ? 'show' : 'hide'
|
const action = isReplyHiddenByThreadgate ? 'show' : 'hide'
|
||||||
const isHide = action === 'hide'
|
const isHide = action === 'hide'
|
||||||
@@ -333,7 +335,7 @@ let PostDropdownBtn = ({
|
|||||||
isReplyHiddenByThreadgate,
|
isReplyHiddenByThreadgate,
|
||||||
rootUri,
|
rootUri,
|
||||||
postUri,
|
postUri,
|
||||||
canHideReply,
|
canHideReplyForEveryone,
|
||||||
toggleReplyVisibility,
|
toggleReplyVisibility,
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -476,25 +478,25 @@ let PostDropdownBtn = ({
|
|||||||
<Menu.ItemText>{_(msg`Mute words & tags`)}</Menu.ItemText>
|
<Menu.ItemText>{_(msg`Mute words & tags`)}</Menu.ItemText>
|
||||||
<Menu.ItemIcon icon={Filter} position="right" />
|
<Menu.ItemIcon icon={Filter} position="right" />
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
|
||||||
{!isAuthor && !isPostHidden && (
|
|
||||||
<Menu.Item
|
|
||||||
testID="postDropdownHideBtn"
|
|
||||||
label={_(msg`Hide post`)}
|
|
||||||
onPress={hidePromptControl.open}>
|
|
||||||
<Menu.ItemText>{_(msg`Hide post`)}</Menu.ItemText>
|
|
||||||
<Menu.ItemIcon icon={EyeSlash} position="right" />
|
|
||||||
</Menu.Item>
|
|
||||||
)}
|
|
||||||
</Menu.Group>
|
</Menu.Group>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{hasSession && (canHideReply || canDetachQuote) && (
|
{hasSession &&
|
||||||
|
(canHideReplyForEveryone || canDetachQuote || canHidePostForMe) && (
|
||||||
<>
|
<>
|
||||||
<Menu.Divider />
|
<Menu.Divider />
|
||||||
<Menu.Group>
|
<Menu.Group>
|
||||||
{canHideReply && (
|
{canHidePostForMe && (
|
||||||
|
<Menu.Item
|
||||||
|
testID="postDropdownHideBtn"
|
||||||
|
label={_(msg`Hide post for me`)}
|
||||||
|
onPress={hidePromptControl.open}>
|
||||||
|
<Menu.ItemText>{_(msg`Hide post for me`)}</Menu.ItemText>
|
||||||
|
<Menu.ItemIcon icon={EyeSlash} position="right" />
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
|
{canHideReplyForEveryone && (
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
testID="postDropdownHideBtn"
|
testID="postDropdownHideBtn"
|
||||||
label={
|
label={
|
||||||
|
|||||||
Reference in New Issue
Block a user