forked from treehouse/mastodon
parent
a74d300b68
commit
b6fa500806
|
@ -0,0 +1,30 @@
|
||||||
|
import api from 'flavours/glitch/util/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, err) => ({
|
||||||
|
type: IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL,
|
||||||
|
accountId,
|
||||||
|
err,
|
||||||
|
});
|
|
@ -62,6 +62,7 @@ class Header extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
account: ImmutablePropTypes.map,
|
account: ImmutablePropTypes.map,
|
||||||
|
identity_props: ImmutablePropTypes.list,
|
||||||
onFollow: PropTypes.func.isRequired,
|
onFollow: PropTypes.func.isRequired,
|
||||||
onBlock: PropTypes.func.isRequired,
|
onBlock: PropTypes.func.isRequired,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
|
@ -73,7 +74,7 @@ class Header extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { account, intl, domain } = this.props;
|
const { account, intl, domain, identity_proofs } = this.props;
|
||||||
|
|
||||||
if (!account) {
|
if (!account) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -227,8 +228,20 @@ class Header extends ImmutablePureComponent {
|
||||||
|
|
||||||
<div className='account__header__extra'>
|
<div className='account__header__extra'>
|
||||||
<div className='account__header__bio'>
|
<div className='account__header__bio'>
|
||||||
{fields.size > 0 && (
|
{ (fields.size > 0 || identity_proofs.size > 0) && (
|
||||||
<div className='account__header__fields'>
|
<div className='account__header__fields'>
|
||||||
|
{identity_proofs.map((proof, i) => (
|
||||||
|
<dl key={i}>
|
||||||
|
<dt dangerouslySetInnerHTML={{ __html: proof.get('provider') }} />
|
||||||
|
|
||||||
|
<dd className='verified'>
|
||||||
|
<a href={proof.get('proof_url')} target='_blank' rel='noopener'><span title={intl.formatMessage(messages.linkVerifiedOn, { date: intl.formatDate(proof.get('updated_at'), dateFormatOptions) })}>
|
||||||
|
<Icon id='check' className='verified__mark' />
|
||||||
|
</span></a>
|
||||||
|
<a href={proof.get('profile_url')} target='_blank' rel='noopener'><span dangerouslySetInnerHTML={{ __html: ' '+proof.get('provider_username') }} /></a>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
))}
|
||||||
{fields.map((pair, i) => (
|
{fields.map((pair, i) => (
|
||||||
<dl key={i}>
|
<dl key={i}>
|
||||||
<dt dangerouslySetInnerHTML={{ __html: pair.get('name_emojified') }} title={pair.get('name')} />
|
<dt dangerouslySetInnerHTML={{ __html: pair.get('name_emojified') }} title={pair.get('name')} />
|
||||||
|
|
|
@ -13,6 +13,7 @@ export default class Header extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
account: ImmutablePropTypes.map,
|
account: ImmutablePropTypes.map,
|
||||||
|
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,
|
||||||
|
@ -85,7 +86,7 @@ export default class Header extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { account, hideTabs } = this.props;
|
const { account, hideTabs, identity_proofs } = this.props;
|
||||||
|
|
||||||
if (account === null) {
|
if (account === null) {
|
||||||
return <MissingIndicator />;
|
return <MissingIndicator />;
|
||||||
|
@ -97,6 +98,7 @@ export default 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}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import { openModal } from 'flavours/glitch/actions/modal';
|
||||||
import { blockDomain, unblockDomain } from 'flavours/glitch/actions/domain_blocks';
|
import { blockDomain, unblockDomain } from 'flavours/glitch/actions/domain_blocks';
|
||||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||||
import { unfollowModal } from 'flavours/glitch/util/initial_state';
|
import { unfollowModal } from 'flavours/glitch/util/initial_state';
|
||||||
|
import { List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' },
|
unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' },
|
||||||
|
@ -35,6 +36,7 @@ const makeMapStateToProps = () => {
|
||||||
const mapStateToProps = (state, { accountId }) => ({
|
const mapStateToProps = (state, { accountId }) => ({
|
||||||
account: getAccount(state, accountId),
|
account: getAccount(state, accountId),
|
||||||
domain: state.getIn(['meta', 'domain']),
|
domain: state.getIn(['meta', 'domain']),
|
||||||
|
identity_proofs: state.getIn(['identity_proofs', accountId], ImmutableList()),
|
||||||
});
|
});
|
||||||
|
|
||||||
return mapStateToProps;
|
return mapStateToProps;
|
||||||
|
|
|
@ -12,6 +12,7 @@ import HeaderContainer from './containers/header_container';
|
||||||
import { List as ImmutableList } from 'immutable';
|
import { List as ImmutableList } from 'immutable';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
import { fetchAccountIdentityProofs } from '../../actions/identity_proofs';
|
||||||
|
|
||||||
const mapStateToProps = (state, { params: { accountId }, withReplies = false }) => {
|
const mapStateToProps = (state, { params: { accountId }, withReplies = false }) => {
|
||||||
const path = withReplies ? `${accountId}:with_replies` : accountId;
|
const path = withReplies ? `${accountId}:with_replies` : accountId;
|
||||||
|
@ -41,6 +42,7 @@ export default class AccountTimeline extends ImmutablePureComponent {
|
||||||
const { params: { accountId }, withReplies } = this.props;
|
const { params: { accountId }, withReplies } = this.props;
|
||||||
|
|
||||||
this.props.dispatch(fetchAccount(accountId));
|
this.props.dispatch(fetchAccount(accountId));
|
||||||
|
this.props.dispatch(fetchAccountIdentityProofs(accountId));
|
||||||
if (!withReplies) {
|
if (!withReplies) {
|
||||||
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
this.props.dispatch(expandAccountFeaturedTimeline(accountId));
|
||||||
}
|
}
|
||||||
|
@ -50,6 +52,7 @@ export default class AccountTimeline extends ImmutablePureComponent {
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
if ((nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) || nextProps.withReplies !== this.props.withReplies) {
|
if ((nextProps.params.accountId !== this.props.params.accountId && nextProps.params.accountId) || nextProps.withReplies !== this.props.withReplies) {
|
||||||
this.props.dispatch(fetchAccount(nextProps.params.accountId));
|
this.props.dispatch(fetchAccount(nextProps.params.accountId));
|
||||||
|
this.props.dispatch(fetchAccountIdentityProofs(nextProps.params.accountId));
|
||||||
if (!nextProps.withReplies) {
|
if (!nextProps.withReplies) {
|
||||||
this.props.dispatch(expandAccountFeaturedTimeline(nextProps.params.accountId));
|
this.props.dispatch(expandAccountFeaturedTimeline(nextProps.params.accountId));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
};
|
|
@ -30,6 +30,7 @@ import listAdder from './list_adder';
|
||||||
import filters from './filters';
|
import filters from './filters';
|
||||||
import pinnedAccountsEditor from './pinned_accounts_editor';
|
import pinnedAccountsEditor from './pinned_accounts_editor';
|
||||||
import polls from './polls';
|
import polls from './polls';
|
||||||
|
import identity_proofs from './identity_proofs';
|
||||||
|
|
||||||
const reducers = {
|
const reducers = {
|
||||||
dropdown_menu,
|
dropdown_menu,
|
||||||
|
@ -57,6 +58,7 @@ const reducers = {
|
||||||
notifications,
|
notifications,
|
||||||
height_cache,
|
height_cache,
|
||||||
custom_emojis,
|
custom_emojis,
|
||||||
|
identity_proofs,
|
||||||
lists,
|
lists,
|
||||||
listEditor,
|
listEditor,
|
||||||
listAdder,
|
listAdder,
|
||||||
|
|
|
@ -10,12 +10,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-container {
|
.logo-container {
|
||||||
margin: 100px auto;
|
margin: 100px auto 50px;
|
||||||
margin-bottom: 50px;
|
|
||||||
|
|
||||||
@media screen and (max-width: 400px) {
|
@media screen and (max-width: 500px) {
|
||||||
margin: 30px auto;
|
margin: 40px auto 0;
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
|
|
@ -854,13 +854,19 @@ code {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
|
max-width: 50%;
|
||||||
|
|
||||||
&-sep {
|
&-sep {
|
||||||
|
align-self: center;
|
||||||
flex-grow: 0;
|
flex-grow: 0;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.account__avatar {
|
.account__avatar {
|
||||||
|
@ -882,12 +888,13 @@ code {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
width: 1px;
|
width: 1px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__row {
|
&__row {
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue