diff --git a/web/modals/threads/thread-settings-modal.react.js b/web/modals/threads/thread-settings-modal.react.js --- a/web/modals/threads/thread-settings-modal.react.js +++ b/web/modals/threads/thread-settings-modal.react.js @@ -107,74 +107,17 @@ +onSubmit: (event: SyntheticEvent) => void, +mainContent: ?React.Node, +buttons: ?React.Node, + +tabs: ?React.Node, }; class ThreadSettingsModal extends React.PureComponent { constructor(props: Props) { super(props); } - possiblyChangedValue(key: string) { - const valueChanged = - this.props.queuedChanges[key] !== null && - this.props.queuedChanges[key] !== undefined; - return valueChanged - ? this.props.queuedChanges[key] - : this.props.threadInfo[key]; - } - render() { - const { threadInfo } = this.props; - - const tabs = [ - , - ]; - - // This UI needs to be updated to handle sidebars but we haven't gotten - // there yet. We'll probably end up ripping it out anyways, so for now we - // are just hiding the privacy tab for any thread that was created as a - // sidebar - const canSeePrivacyTab = - this.possiblyChangedValue('parentThreadID') && - threadInfo.sourceMessageID && - (threadInfo.type === threadTypes.COMMUNITY_OPEN_SUBTHREAD || - threadInfo.type === threadTypes.COMMUNITY_SECRET_SUBTHREAD); - - if (canSeePrivacyTab) { - tabs.push( - , - ); - } - const canDeleteThread = this.props.hasPermissionForTab( - threadInfo, - 'delete', - ); - if (canDeleteThread) { - tabs.push( - , - ); - } - return ( -
    {tabs}
+
    {this.props.tabs}
{this.props.mainContent} @@ -470,6 +413,51 @@ ); } + const tabs = [ + , + ]; + + // This UI needs to be updated to handle sidebars but we haven't gotten + // there yet. We'll probably end up ripping it out anyways, so for now we + // are just hiding the privacy tab for any thread that was created as a + // sidebar + const canSeePrivacyTab = + (queuedChanges['parentThreadID'] ?? threadInfo['parentThreadID']) && + threadInfo.sourceMessageID && + (threadInfo.type === threadTypes.COMMUNITY_OPEN_SUBTHREAD || + threadInfo.type === threadTypes.COMMUNITY_SECRET_SUBTHREAD); + + if (canSeePrivacyTab) { + tabs.push( + , + ); + } + + const canDeleteThread = hasPermissionForTab(threadInfo, 'delete'); + if (canDeleteThread) { + tabs.push( + , + ); + } + return ( ); },