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,75 +478,75 @@ 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.Group>
|
<Menu.Divider />
|
||||||
{canHideReply && (
|
<Menu.Group>
|
||||||
<Menu.Item
|
{canHidePostForMe && (
|
||||||
testID="postDropdownHideBtn"
|
<Menu.Item
|
||||||
label={
|
testID="postDropdownHideBtn"
|
||||||
isReplyHiddenByThreadgate
|
label={_(msg`Hide post for me`)}
|
||||||
? _(msg`Show reply for everyone`)
|
onPress={hidePromptControl.open}>
|
||||||
: _(msg`Hide reply for everyone`)
|
<Menu.ItemText>{_(msg`Hide post for me`)}</Menu.ItemText>
|
||||||
}
|
<Menu.ItemIcon icon={EyeSlash} position="right" />
|
||||||
onPress={onToggleReplyVisibility}>
|
</Menu.Item>
|
||||||
<Menu.ItemText>
|
)}
|
||||||
{isReplyHiddenByThreadgate
|
{canHideReplyForEveryone && (
|
||||||
? _(msg`Show reply for everyone`)
|
<Menu.Item
|
||||||
: _(msg`Hide reply for everyone`)}
|
testID="postDropdownHideBtn"
|
||||||
</Menu.ItemText>
|
label={
|
||||||
<Menu.ItemIcon
|
isReplyHiddenByThreadgate
|
||||||
icon={isReplyHiddenByThreadgate ? Eye : EyeSlash}
|
? _(msg`Show reply for everyone`)
|
||||||
position="right"
|
: _(msg`Hide reply for everyone`)
|
||||||
/>
|
|
||||||
</Menu.Item>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{canDetachQuote && (
|
|
||||||
<Menu.Item
|
|
||||||
disabled={isPending}
|
|
||||||
testID="postDropdownHideBtn"
|
|
||||||
label={
|
|
||||||
quoteEmbed.isDetached
|
|
||||||
? _(msg`Re-attach quote`)
|
|
||||||
: _(msg`Detach quote`)
|
|
||||||
}
|
|
||||||
onPress={onToggleQuotePostAttachment}>
|
|
||||||
<Menu.ItemText>
|
|
||||||
{quoteEmbed.isDetached
|
|
||||||
? _(msg`Re-attach quote`)
|
|
||||||
: _(msg`Detach quote`)}
|
|
||||||
</Menu.ItemText>
|
|
||||||
<Menu.ItemIcon
|
|
||||||
icon={
|
|
||||||
isPending
|
|
||||||
? Loader
|
|
||||||
: quoteEmbed.isDetached
|
|
||||||
? Eye
|
|
||||||
: EyeSlash
|
|
||||||
}
|
}
|
||||||
position="right"
|
onPress={onToggleReplyVisibility}>
|
||||||
/>
|
<Menu.ItemText>
|
||||||
</Menu.Item>
|
{isReplyHiddenByThreadgate
|
||||||
)}
|
? _(msg`Show reply for everyone`)
|
||||||
</Menu.Group>
|
: _(msg`Hide reply for everyone`)}
|
||||||
</>
|
</Menu.ItemText>
|
||||||
)}
|
<Menu.ItemIcon
|
||||||
|
icon={isReplyHiddenByThreadgate ? Eye : EyeSlash}
|
||||||
|
position="right"
|
||||||
|
/>
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{canDetachQuote && (
|
||||||
|
<Menu.Item
|
||||||
|
disabled={isPending}
|
||||||
|
testID="postDropdownHideBtn"
|
||||||
|
label={
|
||||||
|
quoteEmbed.isDetached
|
||||||
|
? _(msg`Re-attach quote`)
|
||||||
|
: _(msg`Detach quote`)
|
||||||
|
}
|
||||||
|
onPress={onToggleQuotePostAttachment}>
|
||||||
|
<Menu.ItemText>
|
||||||
|
{quoteEmbed.isDetached
|
||||||
|
? _(msg`Re-attach quote`)
|
||||||
|
: _(msg`Detach quote`)}
|
||||||
|
</Menu.ItemText>
|
||||||
|
<Menu.ItemIcon
|
||||||
|
icon={
|
||||||
|
isPending
|
||||||
|
? Loader
|
||||||
|
: quoteEmbed.isDetached
|
||||||
|
? Eye
|
||||||
|
: EyeSlash
|
||||||
|
}
|
||||||
|
position="right"
|
||||||
|
/>
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
|
</Menu.Group>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{hasSession && (
|
{hasSession && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user