Skip to content

Commit

Permalink
disable explore for anonymous users
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis committed Oct 4, 2024
1 parent cf09ee7 commit 07def46
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
40 changes: 24 additions & 16 deletions app/javascript/mastodon/features/explore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Suggestions from './suggestions';
import Search from 'mastodon/features/compose/containers/search_container';
import SearchResults from './results';
import { Helmet } from 'react-helmet';
import { showTrends } from 'mastodon/initial_state';
import { timelinePreview, showTrends } from 'mastodon/initial_state';

const messages = defineMessages({
title: { id: 'explore.title', defaultMessage: 'Explore' },
Expand Down Expand Up @@ -70,28 +70,36 @@ class Explore extends React.PureComponent {
) : (
<>
<div className='account__section-headline'>
<NavLink exact to='/explore'>
<FormattedMessage tagName='div' id='explore.trending_statuses' defaultMessage='Posts' />
</NavLink>
<NavLink exact to='/explore/tags'>
<FormattedMessage tagName='div' id='explore.trending_tags' defaultMessage='Hashtags' />
</NavLink>
<NavLink exact to='/explore/links'>
<FormattedMessage tagName='div' id='explore.trending_links' defaultMessage='News' />
</NavLink>
{timelinePreview && (
<NavLink exact to='/explore'>
<FormattedMessage tagName='div' id='explore.trending_statuses' defaultMessage='Posts' />
</NavLink>
)}
{timelinePreview && (
<NavLink exact to='/explore/tags'>
<FormattedMessage tagName='div' id='explore.trending_tags' defaultMessage='Hashtags' />
</NavLink>
)}
{timelinePreview && (
<NavLink exact to='/explore/links'>
<FormattedMessage tagName='div' id='explore.trending_links' defaultMessage='News' />
</NavLink>
)}
{signedIn && (
<NavLink exact to='/explore/suggestions'>
<FormattedMessage tagName='div' id='explore.suggested_follows' defaultMessage='For you' />
</NavLink>
)}
</div>

<Switch>
<Route path='/explore/tags' component={Tags} />
<Route path='/explore/links' component={Links} />
<Route path='/explore/suggestions' component={Suggestions} />
<Route exact path={['/explore', '/explore/posts', '/search']} component={Statuses} componentParams={{ multiColumn }} />
</Switch>
{timelinePreview && (
<Switch>
<Route path='/explore/tags' component={Tags} />
<Route path='/explore/links' component={Links} />
<Route path='/explore/suggestions' component={Suggestions} />
<Route exact path={['/explore', '/explore/posts', '/search']} component={Statuses} componentParams={{ multiColumn }} />
</Switch>
)}

<Helmet>
<title>{intl.formatMessage(messages.title)}</title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class NavigationPanel extends React.Component {
<ColumnLink transparent to='/about' icon='ellipsis-h' text={intl.formatMessage(messages.about)} />
</div>

<NavigationPortal />
{(signedIn || timelinePreview) && <NavigationPortal />}
</div>
);
}
Expand Down

0 comments on commit 07def46

Please sign in to comment.