Rip out identity_proofs
This commit is contained in:
parent
3b0530073e
commit
165d6d197e
9 changed files with 3 additions and 103 deletions
|
@ -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,
|
|
||||||
});
|
|
|
@ -86,7 +86,6 @@ class Header extends ImmutablePureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
account: ImmutablePropTypes.record,
|
account: ImmutablePropTypes.record,
|
||||||
meaccount: ImmutablePropTypes.record,
|
meaccount: ImmutablePropTypes.record,
|
||||||
identity_props: ImmutablePropTypes.list,
|
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
username: PropTypes.string,
|
username: PropTypes.string,
|
||||||
features: PropTypes.object,
|
features: PropTypes.object,
|
||||||
|
|
|
@ -13,7 +13,6 @@ class Header extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
account: ImmutablePropTypes.record,
|
account: ImmutablePropTypes.record,
|
||||||
identity_proofs: ImmutablePropTypes.list,
|
|
||||||
onFollow: PropTypes.func.isRequired,
|
onFollow: PropTypes.func.isRequired,
|
||||||
onBlock: PropTypes.func.isRequired,
|
onBlock: PropTypes.func.isRequired,
|
||||||
onMention: PropTypes.func.isRequired,
|
onMention: PropTypes.func.isRequired,
|
||||||
|
@ -143,7 +142,7 @@ class Header extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { account, identity_proofs } = this.props;
|
const { account } = this.props;
|
||||||
const moved = (account) ? account.get('moved') : false;
|
const moved = (account) ? account.get('moved') : false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -152,7 +151,6 @@ class Header extends ImmutablePureComponent {
|
||||||
|
|
||||||
<InnerHeader
|
<InnerHeader
|
||||||
account={account}
|
account={account}
|
||||||
identity_proofs={identity_proofs}
|
|
||||||
onFollow={this.handleFollow}
|
onFollow={this.handleFollow}
|
||||||
onBlock={this.handleBlock}
|
onBlock={this.handleBlock}
|
||||||
onMention={this.handleMention}
|
onMention={this.handleMention}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { List as ImmutableList } from 'immutable';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
@ -64,7 +63,6 @@ const makeMapStateToProps = () => {
|
||||||
|
|
||||||
const mapStateToProps = (state, { accountId }) => ({
|
const mapStateToProps = (state, { accountId }) => ({
|
||||||
account: getAccount(state, accountId),
|
account: getAccount(state, accountId),
|
||||||
identity_proofs: state.getIn(['identity_proofs', accountId], ImmutableList()),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return mapStateToProps;
|
return mapStateToProps;
|
||||||
|
|
|
@ -13,7 +13,6 @@ import { makeGetStatusIds, findAccountByUsername } from 'soapbox/selectors';
|
||||||
import { getFeatures } from 'soapbox/utils/features';
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
|
|
||||||
import { fetchAccount, fetchAccountByUsername } from '../../actions/accounts';
|
import { fetchAccount, fetchAccountByUsername } from '../../actions/accounts';
|
||||||
import { fetchAccountIdentityProofs } from '../../actions/identity_proofs';
|
|
||||||
import { fetchPatronAccount } from '../../actions/patron';
|
import { fetchPatronAccount } from '../../actions/patron';
|
||||||
import { expandAccountFeaturedTimeline, expandAccountTimeline } from '../../actions/timelines';
|
import { expandAccountFeaturedTimeline, expandAccountTimeline } from '../../actions/timelines';
|
||||||
import StatusList from '../../components/status_list';
|
import StatusList from '../../components/status_list';
|
||||||
|
@ -84,11 +83,10 @@ class AccountTimeline extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { params: { username }, accountId, accountApId, withReplies, me, patronEnabled } = this.props;
|
const { params: { username }, accountId, accountApId, withReplies, patronEnabled } = this.props;
|
||||||
|
|
||||||
if (accountId && accountId !== -1) {
|
if (accountId && accountId !== -1) {
|
||||||
this.props.dispatch(fetchAccount(accountId));
|
this.props.dispatch(fetchAccount(accountId));
|
||||||
if (me) this.props.dispatch(fetchAccountIdentityProofs(accountId));
|
|
||||||
|
|
||||||
if (!withReplies) {
|
if (!withReplies) {
|
||||||
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
||||||
|
@ -105,11 +103,10 @@ class AccountTimeline extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
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) {
|
if (accountId && (accountId !== -1) && (accountId !== prevProps.accountId) || withReplies !== prevProps.withReplies) {
|
||||||
this.props.dispatch(fetchAccount(accountId));
|
this.props.dispatch(fetchAccount(accountId));
|
||||||
if (me) this.props.dispatch(fetchAccountIdentityProofs(accountId));
|
|
||||||
|
|
||||||
if (!withReplies) {
|
if (!withReplies) {
|
||||||
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
||||||
|
|
|
@ -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,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -29,7 +29,6 @@ import group_lists from './group_lists';
|
||||||
import group_relationships from './group_relationships';
|
import group_relationships from './group_relationships';
|
||||||
import groups from './groups';
|
import groups from './groups';
|
||||||
import history from './history';
|
import history from './history';
|
||||||
import identity_proofs from './identity_proofs';
|
|
||||||
import instance from './instance';
|
import instance from './instance';
|
||||||
import listAdder from './list_adder';
|
import listAdder from './list_adder';
|
||||||
import listEditor from './list_editor';
|
import listEditor from './list_editor';
|
||||||
|
@ -86,7 +85,6 @@ const reducers = {
|
||||||
search,
|
search,
|
||||||
notifications,
|
notifications,
|
||||||
custom_emojis,
|
custom_emojis,
|
||||||
identity_proofs,
|
|
||||||
lists,
|
lists,
|
||||||
listEditor,
|
listEditor,
|
||||||
listAdder,
|
listAdder,
|
||||||
|
|
|
@ -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`
|
- `lists`
|
||||||
|
|
||||||
Sample:
|
Sample:
|
||||||
|
|
Loading…
Reference in a new issue