From 165d6d197e14d56b1d96fd2610cbe6ad0d24cc84 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 14 May 2022 12:01:21 -0500 Subject: [PATCH] Rip out identity_proofs --- app/soapbox/actions/identity_proofs.js | 30 ----------------- .../features/account/components/header.js | 1 - .../account_timeline/components/header.js | 4 +-- .../containers/header_container.js | 2 -- .../features/account_timeline/index.js | 7 ++-- .../__tests__/identity_proofs-test.js | 32 ------------------- app/soapbox/reducers/identity_proofs.js | 26 --------------- app/soapbox/reducers/index.ts | 2 -- docs/store.md | 2 -- 9 files changed, 3 insertions(+), 103 deletions(-) delete mode 100644 app/soapbox/actions/identity_proofs.js delete mode 100644 app/soapbox/reducers/__tests__/identity_proofs-test.js delete mode 100644 app/soapbox/reducers/identity_proofs.js diff --git a/app/soapbox/actions/identity_proofs.js b/app/soapbox/actions/identity_proofs.js deleted file mode 100644 index a14455a64..000000000 --- a/app/soapbox/actions/identity_proofs.js +++ /dev/null @@ -1,30 +0,0 @@ -import api from '../api'; - -export const IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST = 'IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST'; -export const IDENTITY_PROOFS_ACCOUNT_FETCH_SUCCESS = 'IDENTITY_PROOFS_ACCOUNT_FETCH_SUCCESS'; -export const IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL = 'IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL'; - -export const fetchAccountIdentityProofs = accountId => (dispatch, getState) => { - dispatch(fetchAccountIdentityProofsRequest(accountId)); - - api(getState).get(`/api/v1/accounts/${accountId}/identity_proofs`) - .then(({ data }) => dispatch(fetchAccountIdentityProofsSuccess(accountId, data))) - .catch(err => dispatch(fetchAccountIdentityProofsFail(accountId, err))); -}; - -export const fetchAccountIdentityProofsRequest = id => ({ - type: IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST, - id, -}); - -export const fetchAccountIdentityProofsSuccess = (accountId, identity_proofs) => ({ - type: IDENTITY_PROOFS_ACCOUNT_FETCH_SUCCESS, - accountId, - identity_proofs, -}); - -export const fetchAccountIdentityProofsFail = (accountId, error) => ({ - type: IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL, - accountId, - error, -}); diff --git a/app/soapbox/features/account/components/header.js b/app/soapbox/features/account/components/header.js index b16892cb8..36a0b7b7e 100644 --- a/app/soapbox/features/account/components/header.js +++ b/app/soapbox/features/account/components/header.js @@ -86,7 +86,6 @@ class Header extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.record, meaccount: ImmutablePropTypes.record, - identity_props: ImmutablePropTypes.list, intl: PropTypes.object.isRequired, username: PropTypes.string, features: PropTypes.object, diff --git a/app/soapbox/features/account_timeline/components/header.js b/app/soapbox/features/account_timeline/components/header.js index 740225878..b969e0b61 100644 --- a/app/soapbox/features/account_timeline/components/header.js +++ b/app/soapbox/features/account_timeline/components/header.js @@ -13,7 +13,6 @@ class Header extends ImmutablePureComponent { static propTypes = { account: ImmutablePropTypes.record, - identity_proofs: ImmutablePropTypes.list, onFollow: PropTypes.func.isRequired, onBlock: PropTypes.func.isRequired, onMention: PropTypes.func.isRequired, @@ -143,7 +142,7 @@ class Header extends ImmutablePureComponent { } render() { - const { account, identity_proofs } = this.props; + const { account } = this.props; const moved = (account) ? account.get('moved') : false; return ( @@ -152,7 +151,6 @@ class Header extends ImmutablePureComponent { { const mapStateToProps = (state, { accountId }) => ({ account: getAccount(state, accountId), - identity_proofs: state.getIn(['identity_proofs', accountId], ImmutableList()), }); return mapStateToProps; diff --git a/app/soapbox/features/account_timeline/index.js b/app/soapbox/features/account_timeline/index.js index 207344bcd..c394eecf2 100644 --- a/app/soapbox/features/account_timeline/index.js +++ b/app/soapbox/features/account_timeline/index.js @@ -13,7 +13,6 @@ import { makeGetStatusIds, findAccountByUsername } from 'soapbox/selectors'; import { getFeatures } from 'soapbox/utils/features'; import { fetchAccount, fetchAccountByUsername } from '../../actions/accounts'; -import { fetchAccountIdentityProofs } from '../../actions/identity_proofs'; import { fetchPatronAccount } from '../../actions/patron'; import { expandAccountFeaturedTimeline, expandAccountTimeline } from '../../actions/timelines'; import StatusList from '../../components/status_list'; @@ -84,11 +83,10 @@ class AccountTimeline extends ImmutablePureComponent { }; componentDidMount() { - const { params: { username }, accountId, accountApId, withReplies, me, patronEnabled } = this.props; + const { params: { username }, accountId, accountApId, withReplies, patronEnabled } = this.props; if (accountId && accountId !== -1) { this.props.dispatch(fetchAccount(accountId)); - if (me) this.props.dispatch(fetchAccountIdentityProofs(accountId)); if (!withReplies) { this.props.dispatch(expandAccountFeaturedTimeline(accountId)); @@ -105,11 +103,10 @@ class AccountTimeline extends ImmutablePureComponent { } componentDidUpdate(prevProps) { - const { params: { username }, me, accountId, withReplies, accountApId, patronEnabled } = this.props; + const { params: { username }, accountId, withReplies, accountApId, patronEnabled } = this.props; if (accountId && (accountId !== -1) && (accountId !== prevProps.accountId) || withReplies !== prevProps.withReplies) { this.props.dispatch(fetchAccount(accountId)); - if (me) this.props.dispatch(fetchAccountIdentityProofs(accountId)); if (!withReplies) { this.props.dispatch(expandAccountFeaturedTimeline(accountId)); diff --git a/app/soapbox/reducers/__tests__/identity_proofs-test.js b/app/soapbox/reducers/__tests__/identity_proofs-test.js deleted file mode 100644 index fd004bfa8..000000000 --- a/app/soapbox/reducers/__tests__/identity_proofs-test.js +++ /dev/null @@ -1,32 +0,0 @@ -import { Map as ImmutableMap } from 'immutable'; - -import * as actions from 'soapbox/actions/identity_proofs'; - -import reducer from '../identity_proofs'; - -describe('identity_proofs reducer', () => { - it('should return the initial state', () => { - expect(reducer(undefined, {})).toEqual(ImmutableMap()); - }); - - it('should handle IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST', () => { - const state = ImmutableMap({ isLoading: false }); - const action = { - type: actions.IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST, - }; - expect(reducer(state, action).toJS()).toMatchObject({ - isLoading: true, - }); - }); - - it('should handle IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL', () => { - const state = ImmutableMap({ isLoading: true }); - const action = { - type: actions.IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL, - }; - expect(reducer(state, action).toJS()).toMatchObject({ - isLoading: false, - }); - }); - -}); diff --git a/app/soapbox/reducers/identity_proofs.js b/app/soapbox/reducers/identity_proofs.js deleted file mode 100644 index cb6721b07..000000000 --- a/app/soapbox/reducers/identity_proofs.js +++ /dev/null @@ -1,26 +0,0 @@ -import { Map as ImmutableMap, fromJS } from 'immutable'; - -import { - IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST, - IDENTITY_PROOFS_ACCOUNT_FETCH_SUCCESS, - IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL, -} from '../actions/identity_proofs'; - -const initialState = ImmutableMap(); - -export default function identityProofsReducer(state = initialState, action) { - switch (action.type) { - case IDENTITY_PROOFS_ACCOUNT_FETCH_REQUEST: - return state.set('isLoading', true); - case IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL: - return state.set('isLoading', false); - case IDENTITY_PROOFS_ACCOUNT_FETCH_SUCCESS: - return state.update(identity_proofs => identity_proofs.withMutations(map => { - map.set('isLoading', false); - map.set('loaded', true); - map.set(action.accountId, fromJS(action.identity_proofs)); - })); - default: - return state; - } -} diff --git a/app/soapbox/reducers/index.ts b/app/soapbox/reducers/index.ts index 084b9d776..a05ef47c4 100644 --- a/app/soapbox/reducers/index.ts +++ b/app/soapbox/reducers/index.ts @@ -29,7 +29,6 @@ import group_lists from './group_lists'; import group_relationships from './group_relationships'; import groups from './groups'; import history from './history'; -import identity_proofs from './identity_proofs'; import instance from './instance'; import listAdder from './list_adder'; import listEditor from './list_editor'; @@ -86,7 +85,6 @@ const reducers = { search, notifications, custom_emojis, - identity_proofs, lists, listEditor, listAdder, diff --git a/docs/store.md b/docs/store.md index 7c0bff506..994059c22 100644 --- a/docs/store.md +++ b/docs/store.md @@ -691,8 +691,6 @@ If it's not documented, it's because I inherited it from Mastodon and I don't kn ] ``` -- `identity_proofs` - - `lists` Sample: