Correctly compute if user can edit reply settings

This commit is contained in:
Eric Bailey
2024-08-09 17:17:57 -05:00
parent f7eb2b4031
commit e5030d0556
+5 -3
View File
@@ -149,8 +149,7 @@ let PostDropdownBtn = ({
) )
const isPostHidden = hiddenPosts && hiddenPosts.includes(postUri) const isPostHidden = hiddenPosts && hiddenPosts.includes(postUri)
const isAuthor = postAuthor.did === currentAccount?.did const isAuthor = postAuthor.did === currentAccount?.did
const isRootPostAuthor = const isRootPostAuthor = new AtUri(rootUri).host === currentAccount?.did
rootPostUri && new AtUri(rootPostUri).host === currentAccount?.did
const isReplyHiddenByThreadgate = const isReplyHiddenByThreadgate =
threadgateRecord?.hiddenReplies?.includes(postUri) threadgateRecord?.hiddenReplies?.includes(postUri)
@@ -648,6 +647,7 @@ let PostDropdownBtn = ({
control={postInteractionSettingsDialogControl} control={postInteractionSettingsDialogControl}
postUri={post.uri} postUri={post.uri}
threadgateRecord={threadgateRecord} threadgateRecord={threadgateRecord}
replySettingsDisabled={!isRootPostAuthor}
/> />
</EventStopper> </EventStopper>
) )
@@ -657,6 +657,7 @@ export function PostInteractionSettingsDialogControlled(props: {
control: Dialog.DialogControlProps control: Dialog.DialogControlProps
postUri: string postUri: string
threadgateRecord?: AppBskyFeedThreadgate.Record threadgateRecord?: AppBskyFeedThreadgate.Record
replySettingsDisabled: boolean
}) { }) {
return ( return (
<Dialog.Outer control={props.control}> <Dialog.Outer control={props.control}>
@@ -670,6 +671,7 @@ function PostInteractionSettingsDialogControlledInner(props: {
control: Dialog.DialogControlProps control: Dialog.DialogControlProps
postUri: string postUri: string
threadgateRecord?: AppBskyFeedThreadgate.Record threadgateRecord?: AppBskyFeedThreadgate.Record
replySettingsDisabled: boolean
}) { }) {
const {_} = useLingui() const {_} = useLingui()
const threadgateAllowUISettings = React.useMemo(() => { const threadgateAllowUISettings = React.useMemo(() => {
@@ -733,7 +735,7 @@ function PostInteractionSettingsDialogControlledInner(props: {
<Loader size="xl" /> <Loader size="xl" />
) : ( ) : (
<PostInteractionSettingsDialogInner <PostInteractionSettingsDialogInner
replySettingsDisabled replySettingsDisabled={props.replySettingsDisabled}
isSaving={isSaving} isSaving={isSaving}
onSave={onSave} onSave={onSave}
postgate={ postgate={