]>
cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/containers/status_container.js
1 import React
from 'react' ;
2 import { connect
} from 'react-redux' ;
3 import Status
from '../components/status' ;
4 import { makeGetStatus
} from '../selectors' ;
8 } from '../actions/compose' ;
16 } from '../actions/interactions' ;
17 import { blockAccount
} from '../actions/accounts' ;
18 import { muteStatus
, unmuteStatus
, deleteStatus
} from '../actions/statuses' ;
19 import { initMuteModal
} from '../actions/mutes' ;
20 import { initReport
} from '../actions/reports' ;
21 import { openModal
} from '../actions/modal' ;
22 import { defineMessages
, injectIntl
, FormattedMessage
} from 'react-intl' ;
23 import { boostModal
, deleteModal
} from '../initial_state' ;
25 const messages
= defineMessages ({
26 deleteConfirm : { id : 'confirmations.delete.confirm' , defaultMessage : 'Delete' },
27 deleteMessage : { id : 'confirmations.delete.message' , defaultMessage : 'Are you sure you want to delete this status?' },
28 blockConfirm : { id : 'confirmations.block.confirm' , defaultMessage : 'Block' },
31 const makeMapStateToProps
= () => {
32 const getStatus
= makeGetStatus ();
34 const mapStateToProps
= ( state
, props
) => ({
35 status : getStatus ( state
, props
. id
),
38 return mapStateToProps
;
41 const mapDispatchToProps
= ( dispatch
, { intl
}) => ({
43 onReply ( status
, router
) {
44 dispatch ( replyCompose ( status
, router
));
47 onModalReblog ( status
) {
48 dispatch ( reblog ( status
));
51 onReblog ( status
, e
) {
52 if ( status
. get ( 'reblogged' )) {
53 dispatch ( unreblog ( status
));
55 if ( e
. shiftKey
|| ! boostModal
) {
56 this . onModalReblog ( status
);
58 dispatch ( openModal ( 'BOOST' , { status
, onReblog : this . onModalReblog
}));
63 onFavourite ( status
) {
64 if ( status
. get ( 'favourited' )) {
65 dispatch ( unfavourite ( status
));
67 dispatch ( favourite ( status
));
72 if ( status
. get ( 'pinned' )) {
73 dispatch ( unpin ( status
));
75 dispatch ( pin ( status
));
80 dispatch ( openModal ( 'EMBED' , { url : status
. get ( 'url' ) }));
85 dispatch ( deleteStatus ( status
. get ( 'id' )));
87 dispatch ( openModal ( 'CONFIRM' , {
88 message : intl
. formatMessage ( messages
. deleteMessage
),
89 confirm : intl
. formatMessage ( messages
. deleteConfirm
),
90 onConfirm : () => dispatch ( deleteStatus ( status
. get ( 'id' ))),
95 onMention ( account
, router
) {
96 dispatch ( mentionCompose ( account
, router
));
99 onOpenMedia ( media
, index
) {
100 dispatch ( openModal ( 'MEDIA' , { media
, index
}));
103 onOpenVideo ( media
, time
) {
104 dispatch ( openModal ( 'VIDEO' , { media
, time
}));
108 dispatch ( openModal ( 'CONFIRM' , {
109 message : < FormattedMessage id
= 'confirmations.block.message' defaultMessage
= 'Are you sure you want to block {name}?' values
={{ name : < strong
>@{ account
. get ( 'acct' )}</ strong
> }} />,
110 confirm : intl
. formatMessage ( messages
. blockConfirm
),
111 onConfirm : () => dispatch ( blockAccount ( account
. get ( 'id' ))),
116 dispatch ( initReport ( status
. get ( 'account' ), status
));
120 dispatch ( initMuteModal ( account
));
123 onMuteConversation ( status
) {
124 if ( status
. get ( 'muted' )) {
125 dispatch ( unmuteStatus ( status
. get ( 'id' )));
127 dispatch ( muteStatus ( status
. get ( 'id' )));
133 export default injectIntl ( connect ( makeMapStateToProps
, mapDispatchToProps
)( Status
));
This page took 0.11008 seconds and 4 git commands to generate.