Rip out identity_proofs

This commit is contained in:
Alex Gleason 2022-05-14 12:01:21 -05:00
parent 3b0530073e
commit 165d6d197e
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
9 changed files with 3 additions and 103 deletions

View file

@ -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,
});

View file

@ -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,

View file

@ -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 {
<InnerHeader
account={account}
identity_proofs={identity_proofs}
onFollow={this.handleFollow}
onBlock={this.handleBlock}
onMention={this.handleMention}

View file

@ -1,4 +1,3 @@
import { List as ImmutableList } from 'immutable';
import React from 'react';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
@ -64,7 +63,6 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, { accountId }) => ({
account: getAccount(state, accountId),
identity_proofs: state.getIn(['identity_proofs', accountId], ImmutableList()),
});
return mapStateToProps;

View file

@ -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));

View file

@ -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,
});
});
});

View file

@ -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;
}
}

View file

@ -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,

View file

@ -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: