summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2023-09-06 23:13:14 +0200
committerEugen Rochko <eugen@zeonfederated.com>2023-09-06 23:13:14 +0200
commitc013627081becd7882165876c072a28d413ddf37 (patch)
tree3886a893a04990a44f17b8289fd4b544dce44ac9
parent9e3567bfbecbd0a026a4e6fbd41a323d2f5fb567 (diff)
Remove profile directoryremove-profile-directory
-rw-r--r--app/controllers/api/v1/directories_controller.rb55
-rw-r--r--app/javascript/mastodon/features/directory/index.jsx183
-rw-r--r--app/javascript/mastodon/features/explore/components/account_card.jsx (renamed from app/javascript/mastodon/features/directory/components/account_card.jsx)0
-rw-r--r--app/javascript/mastodon/features/explore/suggestions.jsx3
-rw-r--r--app/javascript/mastodon/features/ui/components/columns_area.jsx2
-rw-r--r--app/javascript/mastodon/features/ui/components/link_footer.jsx9
-rw-r--r--app/javascript/mastodon/features/ui/index.jsx2
-rw-r--r--app/javascript/mastodon/features/ui/util/async-components.js4
-rw-r--r--app/javascript/mastodon/initial_state.js2
-rw-r--r--app/models/form/admin_settings.rb2
-rw-r--r--app/serializers/initial_state_serializer.rb1
-rw-r--r--app/views/admin/settings/discovery/show.html.haml5
-rw-r--r--config/routes.rb1
-rw-r--r--config/routes/api.rb2
14 files changed, 3 insertions, 268 deletions
diff --git a/app/controllers/api/v1/directories_controller.rb b/app/controllers/api/v1/directories_controller.rb
deleted file mode 100644
index 1109435507d..00000000000
--- a/app/controllers/api/v1/directories_controller.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-# frozen_string_literal: true
-
-class Api::V1::DirectoriesController < Api::BaseController
- before_action :require_enabled!
- before_action :set_accounts
-
- def show
- cache_if_unauthenticated!
- render json: @accounts, each_serializer: REST::AccountSerializer
- end
-
- private
-
- def require_enabled!
- return not_found unless Setting.profile_directory
- end
-
- def set_accounts
- @accounts = accounts_scope.offset(params[:offset]).limit(limit_param(DEFAULT_ACCOUNTS_LIMIT))
- end
-
- def accounts_scope
- Account.discoverable.tap do |scope|
- scope.merge!(account_order_scope)
- scope.merge!(local_account_scope) if local_accounts?
- scope.merge!(account_exclusion_scope) if current_account
- scope.merge!(account_domain_block_scope) if current_account && !local_accounts?
- end
- end
-
- def local_accounts?
- truthy_param?(:local)
- end
-
- def account_order_scope
- case params[:order]
- when 'new'
- Account.order(id: :desc)
- when 'active', nil
- Account.by_recent_status
- end
- end
-
- def local_account_scope
- Account.local
- end
-
- def account_exclusion_scope
- Account.not_excluded_by_account(current_account)
- end
-
- def account_domain_block_scope
- Account.not_domain_blocked_by_account(current_account)
- end
-end
diff --git a/app/javascript/mastodon/features/directory/index.jsx b/app/javascript/mastodon/features/directory/index.jsx
deleted file mode 100644
index df25331966a..00000000000
--- a/app/javascript/mastodon/features/directory/index.jsx
+++ /dev/null
@@ -1,183 +0,0 @@
-import PropTypes from 'prop-types';
-import { PureComponent } from 'react';
-
-import { defineMessages, injectIntl } from 'react-intl';
-
-import { Helmet } from 'react-helmet';
-
-import { List as ImmutableList } from 'immutable';
-import ImmutablePropTypes from 'react-immutable-proptypes';
-import { connect } from 'react-redux';
-
-import { addColumn, removeColumn, moveColumn, changeColumnParams } from 'mastodon/actions/columns';
-import { fetchDirectory, expandDirectory } from 'mastodon/actions/directory';
-import Column from 'mastodon/components/column';
-import ColumnHeader from 'mastodon/components/column_header';
-import { LoadMore } from 'mastodon/components/load_more';
-import { LoadingIndicator } from 'mastodon/components/loading_indicator';
-import { RadioButton } from 'mastodon/components/radio_button';
-import ScrollContainer from 'mastodon/containers/scroll_container';
-
-import AccountCard from './components/account_card';
-
-const messages = defineMessages({
- title: { id: 'column.directory', defaultMessage: 'Browse profiles' },
- recentlyActive: { id: 'directory.recently_active', defaultMessage: 'Recently active' },
- newArrivals: { id: 'directory.new_arrivals', defaultMessage: 'New arrivals' },
- local: { id: 'directory.local', defaultMessage: 'From {domain} only' },
- federated: { id: 'directory.federated', defaultMessage: 'From known fediverse' },
-});
-
-const mapStateToProps = state => ({
- accountIds: state.getIn(['user_lists', 'directory', 'items'], ImmutableList()),
- isLoading: state.getIn(['user_lists', 'directory', 'isLoading'], true),
- domain: state.getIn(['meta', 'domain']),
-});
-
-class Directory extends PureComponent {
-
- static contextTypes = {
- router: PropTypes.object,
- };
-
- static propTypes = {
- isLoading: PropTypes.bool,
- accountIds: ImmutablePropTypes.list.isRequired,
- dispatch: PropTypes.func.isRequired,
- columnId: PropTypes.string,
- intl: PropTypes.object.isRequired,
- multiColumn: PropTypes.bool,
- domain: PropTypes.string.isRequired,
- params: PropTypes.shape({
- order: PropTypes.string,
- local: PropTypes.bool,
- }),
- };
-
- state = {
- order: null,
- local: null,
- };
-
- handlePin = () => {
- const { columnId, dispatch } = this.props;
-
- if (columnId) {
- dispatch(removeColumn(columnId));
- } else {
- dispatch(addColumn('DIRECTORY', this.getParams(this.props, this.state)));
- }
- };
-
- getParams = (props, state) => ({
- order: state.order === null ? (props.params.order || 'active') : state.order,
- local: state.local === null ? (props.params.local || false) : state.local,
- });
-
- handleMove = dir => {
- const { columnId, dispatch } = this.props;
- dispatch(moveColumn(columnId, dir));
- };
-
- handleHeaderClick = () => {
- this.column.scrollTop();
- };
-
- componentDidMount () {
- const { dispatch } = this.props;
- dispatch(fetchDirectory(this.getParams(this.props, this.state)));
- }
-
- componentDidUpdate (prevProps, prevState) {
- const { dispatch } = this.props;
- const paramsOld = this.getParams(prevProps, prevState);
- const paramsNew = this.getParams(this.props, this.state);
-
- if (paramsOld.order !== paramsNew.order || paramsOld.local !== paramsNew.local) {
- dispatch(fetchDirectory(paramsNew));
- }
- }
-
- setRef = c => {
- this.column = c;
- };
-
- handleChangeOrder = e => {
- const { dispatch, columnId } = this.props;
-
- if (columnId) {
- dispatch(changeColumnParams(columnId, ['order'], e.target.value));
- } else {
- this.setState({ order: e.target.value });
- }
- };
-
- handleChangeLocal = e => {
- const { dispatch, columnId } = this.props;
-
- if (columnId) {
- dispatch(changeColumnParams(columnId, ['local'], e.target.value === '1'));
- } else {
- this.setState({ local: e.target.value === '1' });
- }
- };
-
- handleLoadMore = () => {
- const { dispatch } = this.props;
- dispatch(expandDirectory(this.getParams(this.props, this.state)));
- };
-
- render () {
- const { isLoading, accountIds, intl, columnId, multiColumn, domain } = this.props;
- const { order, local } = this.getParams(this.props, this.state);
- const pinned = !!columnId;
-
- const scrollableArea = (
- <div className='scrollable'>
- <div className='filter-form'>
- <div className='filter-form__column' role='group'>
- <RadioButton name='order' value='active' label={intl.formatMessage(messages.recentlyActive)} checked={order === 'active'} onChange={this.handleChangeOrder} />
- <RadioButton name='order' value='new' label={intl.formatMessage(messages.newArrivals)} checked={order === 'new'} onChange={this.handleChangeOrder} />
- </div>
-
- <div className='filter-form__column' role='group'>
- <RadioButton name='local' value='1' label={intl.formatMessage(messages.local, { domain })} checked={local} onChange={this.handleChangeLocal} />
- <RadioButton name='local' value='0' label={intl.formatMessage(messages.federated)} checked={!local} onChange={this.handleChangeLocal} />
- </div>
- </div>
-
- <div className='directory__list'>
- {isLoading ? <LoadingIndicator /> : accountIds.map(accountId => (
- <AccountCard id={accountId} key={accountId} />
- ))}
- </div>
-
- <LoadMore onClick={this.handleLoadMore} visible={!isLoading} />
- </div>
- );
-
- return (
- <Column bindToDocument={!multiColumn} ref={this.setRef} label={intl.formatMessage(messages.title)}>
- <ColumnHeader
- icon='address-book-o'
- title={intl.formatMessage(messages.title)}
- onPin={this.handlePin}
- onMove={this.handleMove}
- onClick={this.handleHeaderClick}
- pinned={pinned}
- multiColumn={multiColumn}
- />
-
- {multiColumn && !pinned ? <ScrollContainer scrollKey='directory'>{scrollableArea}</ScrollContainer> : scrollableArea}
-
- <Helmet>
- <title>{intl.formatMessage(messages.title)}</title>
- <meta name='robots' content='noindex' />
- </Helmet>
- </Column>
- );
- }
-
-}
-
-export default connect(mapStateToProps)(injectIntl(Directory));
diff --git a/app/javascript/mastodon/features/directory/components/account_card.jsx b/app/javascript/mastodon/features/explore/components/account_card.jsx
index 0306b63d322..0306b63d322 100644
--- a/app/javascript/mastodon/features/directory/components/account_card.jsx
+++ b/app/javascript/mastodon/features/explore/components/account_card.jsx
diff --git a/app/javascript/mastodon/features/explore/suggestions.jsx b/app/javascript/mastodon/features/explore/suggestions.jsx
index f2907cdb222..15b53bb4549 100644
--- a/app/javascript/mastodon/features/explore/suggestions.jsx
+++ b/app/javascript/mastodon/features/explore/suggestions.jsx
@@ -8,7 +8,8 @@ import { connect } from 'react-redux';
import { fetchSuggestions } from 'mastodon/actions/suggestions';
import { LoadingIndicator } from 'mastodon/components/loading_indicator';
-import AccountCard from 'mastodon/features/directory/components/account_card';
+
+import AccountCard from './components/account_card';
const mapStateToProps = state => ({
suggestions: state.getIn(['suggestions', 'items']),
diff --git a/app/javascript/mastodon/features/ui/components/columns_area.jsx b/app/javascript/mastodon/features/ui/components/columns_area.jsx
index 672f28fb7d3..5ce5bfa9faf 100644
--- a/app/javascript/mastodon/features/ui/components/columns_area.jsx
+++ b/app/javascript/mastodon/features/ui/components/columns_area.jsx
@@ -19,7 +19,6 @@ import {
FavouritedStatuses,
BookmarkedStatuses,
ListTimeline,
- Directory,
} from '../util/async-components';
import BundleColumnError from './bundle_column_error';
@@ -40,7 +39,6 @@ const componentMap = {
'FAVOURITES': FavouritedStatuses,
'BOOKMARKS': BookmarkedStatuses,
'LIST': ListTimeline,
- 'DIRECTORY': Directory,
};
export default class ColumnsArea extends ImmutablePureComponent {
diff --git a/app/javascript/mastodon/features/ui/components/link_footer.jsx b/app/javascript/mastodon/features/ui/components/link_footer.jsx
index 7aaa887ac69..251a88b6393 100644
--- a/app/javascript/mastodon/features/ui/components/link_footer.jsx
+++ b/app/javascript/mastodon/features/ui/components/link_footer.jsx
@@ -8,7 +8,7 @@ import { Link } from 'react-router-dom';
import { connect } from 'react-redux';
import { openModal } from 'mastodon/actions/modal';
-import { domain, version, source_url, statusPageUrl, profile_directory as profileDirectory } from 'mastodon/initial_state';
+import { domain, version, source_url, statusPageUrl } from 'mastodon/initial_state';
import { PERMISSION_INVITE_USERS } from 'mastodon/permissions';
import { logOut } from 'mastodon/utils/log_out';
@@ -57,7 +57,6 @@ class LinkFooter extends PureComponent {
const { multiColumn } = this.props;
const canInvite = signedIn && ((permissions & PERMISSION_INVITE_USERS) === PERMISSION_INVITE_USERS);
- const canProfileDirectory = profileDirectory;
const DividingCircle = <span aria-hidden>{' ยท '}</span>;
@@ -79,12 +78,6 @@ class LinkFooter extends PureComponent {
<a href='/invites' target='_blank'><FormattedMessage id='footer.invite' defaultMessage='Invite people' /></a>
</>
)}
- {canProfileDirectory && (
- <>
- {DividingCircle}
- <Link to='/directory'><FormattedMessage id='footer.directory' defaultMessage='Profiles directory' /></Link>
- </>
- )}
{DividingCircle}
<Link to='/privacy-policy' target={multiColumn ? '_blank' : undefined}><FormattedMessage id='footer.privacy_policy' defaultMessage='Privacy policy' /></Link>
</p>
diff --git a/app/javascript/mastodon/features/ui/index.jsx b/app/javascript/mastodon/features/ui/index.jsx
index 55ccde72f5f..028fbe00948 100644
--- a/app/javascript/mastodon/features/ui/index.jsx
+++ b/app/javascript/mastodon/features/ui/index.jsx
@@ -57,7 +57,6 @@ import {
Mutes,
PinnedStatuses,
Lists,
- Directory,
Explore,
Onboarding,
About,
@@ -207,7 +206,6 @@ class SwitchingColumnsArea extends PureComponent {
<WrappedRoute path='/pinned' component={PinnedStatuses} content={children} />
<WrappedRoute path='/start' exact component={Onboarding} content={children} />
- <WrappedRoute path='/directory' component={Directory} content={children} />
<WrappedRoute path={['/explore', '/search']} component={Explore} content={children} />
<WrappedRoute path={['/publish', '/statuses/new']} component={Compose} content={children} />
diff --git a/app/javascript/mastodon/features/ui/util/async-components.js b/app/javascript/mastodon/features/ui/util/async-components.js
index 7b968204be3..e4a01e4d1ac 100644
--- a/app/javascript/mastodon/features/ui/util/async-components.js
+++ b/app/javascript/mastodon/features/ui/util/async-components.js
@@ -150,10 +150,6 @@ export function Audio () {
return import(/* webpackChunkName: "features/audio" */'../../audio');
}
-export function Directory () {
- return import(/* webpackChunkName: "features/directory" */'../../directory');
-}
-
export function Onboarding () {
return import(/* webpackChunkName: "features/onboarding" */'../../onboarding');
}
diff --git a/app/javascript/mastodon/initial_state.js b/app/javascript/mastodon/initial_state.js
index 11cd2a16732..06d909ee775 100644
--- a/app/javascript/mastodon/initial_state.js
+++ b/app/javascript/mastodon/initial_state.js
@@ -63,7 +63,6 @@
* @property {string=} me
* @property {string=} moved_to_account_id
* @property {string=} owner
- * @property {boolean} profile_directory
* @property {boolean} registrations_open
* @property {boolean} reduce_motion
* @property {string} repository
@@ -124,7 +123,6 @@ export const mascot = getMeta('mascot');
export const me = getMeta('me');
export const movedToAccountId = getMeta('moved_to_account_id');
export const owner = getMeta('owner');
-export const profile_directory = getMeta('profile_directory');
export const reduceMotion = getMeta('reduce_motion');
export const registrationsOpen = getMeta('registrations_open');
export const repository = getMeta('repository');
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index 7be026d85ff..15539a4cbcc 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -21,7 +21,6 @@ class Form::AdminSettings
peers_api_enabled
preview_sensitive_media
custom_css
- profile_directory
thumbnail
mascot
trends
@@ -50,7 +49,6 @@ class Form::AdminSettings
activity_api_enabled
peers_api_enabled
preview_sensitive_media
- profile_directory
trends
trends_as_landing_page
trendable_by_default
diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb
index 56d45c588e2..1d60cf86d25 100644
--- a/app/serializers/initial_state_serializer.rb
+++ b/app/serializers/initial_state_serializer.rb
@@ -26,7 +26,6 @@ class InitialStateSerializer < ActiveModel::Serializer
version: instance_presenter.version,
limited_federation_mode: Rails.configuration.x.limited_federation_mode,
mascot: instance_presenter.mascot&.file&.url,
- profile_directory: Setting.profile_directory,
trends_enabled: Setting.trends,
registrations_open: Setting.registrations_mode != 'none' && !Rails.configuration.x.single_user_mode,
timeline_preview: Setting.timeline_preview,
diff --git a/app/views/admin/settings/discovery/show.html.haml b/app/views/admin/settings/discovery/show.html.haml
index 62011d5c567..c8f4a8e8783 100644
--- a/app/views/admin/settings/discovery/show.html.haml
+++ b/app/views/admin/settings/discovery/show.html.haml
@@ -49,10 +49,5 @@
.fields-group
= f.input :bootstrap_timeline_accounts, wrapper: :with_block_label
- %h4= t('admin.settings.discovery.profile_directory')
-
- .fields-group
- = f.input :profile_directory, as: :boolean, wrapper: :with_label
-
.actions
= f.button :button, t('generic.save_changes'), type: :submit
diff --git a/config/routes.rb b/config/routes.rb
index 5de8562a8c4..9a7377bdf39 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -20,7 +20,6 @@ Rails.application.routes.draw do
/bookmarks
/pinned
/start
- /directory
/explore/(*any)
/search
/publish
diff --git a/config/routes/api.rb b/config/routes/api.rb
index 66eb82f59a1..bb1fcaffc81 100644
--- a/config/routes/api.rb
+++ b/config/routes/api.rb
@@ -135,8 +135,6 @@ namespace :api, format: false do
resource :domain_blocks, only: [:show, :create, :destroy]
- resource :directory, only: [:show]
-
resources :follow_requests, only: [:index] do
member do
post :authorize