diff --git a/web/src/App.tsx b/web/src/App.tsx index 098b8ab2d..8c6e72e47 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -49,7 +49,8 @@ const App: React.FC = React.memo(function App({ customComponents, currentUserProfileURL = '', defaultSettingsURL = '', - isPublicAccessEnabledOnResources = false + isPublicAccessEnabledOnResources = false, + isCurrentSessionPublic = false }: AppProps) { const [strings, setStrings] = useState() const getRequestOptions = useCallback( @@ -92,7 +93,8 @@ const App: React.FC = React.memo(function App({ customComponents, currentUserProfileURL, defaultSettingsURL, - isPublicAccessEnabledOnResources + isPublicAccessEnabledOnResources, + isCurrentSessionPublic }}> ({ currentUserProfileURL: '', routingId: '', defaultSettingsURL: '', - isPublicAccessEnabledOnResources: false + isPublicAccessEnabledOnResources: false, + isCurrentSessionPublic: false }) export const AppContextProvider: React.FC<{ value: AppProps }> = React.memo(function AppContextProvider({ diff --git a/web/src/AppProps.ts b/web/src/AppProps.ts index 905f6c83d..ecd93f7f9 100644 --- a/web/src/AppProps.ts +++ b/web/src/AppProps.ts @@ -79,4 +79,5 @@ export interface AppProps { currentUserProfileURL: string defaultSettingsURL: string isPublicAccessEnabledOnResources: boolean + isCurrentSessionPublic: boolean } diff --git a/web/src/bootstrap.tsx b/web/src/bootstrap.tsx index 3ed96d8c9..8b25b7c42 100644 --- a/web/src/bootstrap.tsx +++ b/web/src/bootstrap.tsx @@ -51,6 +51,7 @@ ReactDOM.render( routingId="" defaultSettingsURL="" isPublicAccessEnabledOnResources + isCurrentSessionPublic={false} />, document.getElementById('react-root') ) diff --git a/web/src/components/CodeSearchBar/CodeSearchBar.tsx b/web/src/components/CodeSearchBar/CodeSearchBar.tsx index 599e68ac4..4411345b8 100644 --- a/web/src/components/CodeSearchBar/CodeSearchBar.tsx +++ b/web/src/components/CodeSearchBar/CodeSearchBar.tsx @@ -42,7 +42,7 @@ const KEYWORD_REGEX = /((?:(?:-{0,1})(?:repo|lang|file|case|count)):\S*|(?: or|a const CodeSearchBar: FC = ({ value, onChange, onSearch, onKeyDown, searchMode, setSearchMode }) => { const { getString } = useStrings() - const { hooks, routingId, defaultSettingsURL } = useAppContext() + const { hooks, routingId, defaultSettingsURL, isCurrentSessionPublic } = useAppContext() const { SEMANTIC_SEARCH_ENABLED: isSemanticSearchFFEnabled } = hooks?.useFeatureFlags() const { orgIdentifier, projectIdentifier } = useParams() const { data: aidaSettingResponse, loading: isAidaSettingLoading } = hooks?.useGetSettingValue({ @@ -51,7 +51,9 @@ const CodeSearchBar: FC = ({ value, onChange, onSearch, onKe }) const [enableSemanticSearch, setEnableSemanticSearch] = useState(false) useEffect(() => { - setEnableSemanticSearch(isSemanticSearchFFEnabled && aidaSettingResponse?.data?.value == 'true') + setEnableSemanticSearch( + isSemanticSearchFFEnabled && aidaSettingResponse?.data?.value == 'true' && !isCurrentSessionPublic + ) }, [isAidaSettingLoading, isSemanticSearchFFEnabled]) const isSemanticMode = enableSemanticSearch && searchMode === SEARCH_MODE.SEMANTIC return (