diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js index 24521a435..07e15a1c6 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/mastodon/components/status.js @@ -11,7 +11,7 @@ import StatusContent from './status_content'; import StatusActionBar from './status_action_bar'; import AttachmentList from './attachment_list'; import Card from '../features/status/components/card'; -import { injectIntl, FormattedMessage } from 'react-intl'; +import { injectIntl, FormattedMessage, FormattedNumber } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { MediaGallery, Video, Audio } from '../features/ui/util/async-components'; import { HotKeys } from 'react-hotkeys'; @@ -20,7 +20,6 @@ import Icon from 'mastodon/components/icon'; import { displayMedia } from '../initial_state'; import StatusContainer from '../containers/status_container2'; -//import DetailedStatus from '../features/status/components/detailed_status'; // We use the component (and not the container) since we do not want // to use the progress bar to show download progress @@ -309,7 +308,7 @@ class Status extends ImmutablePureComponent { let statusAvatar, prepend, rebloggedByText; let sons; - const { intl, hidden, featured, otherAccounts, unread, showThread, sonsIds } = this.props; + const { intl, hidden, featured, otherAccounts, unread, showThread, deep, sonsIds } = this.props; let { status, account, ...other } = this.props; @@ -467,6 +466,19 @@ class Status extends ImmutablePureComponent { if(status.get('in_reply_to_id') == null && sonsIds && sonsIds.size > 0) { sons =
{this.renderChildren(sonsIds)}
; } + + let deepRec; + if(deep != null) { + deepRec = ( +
+ + + 【】 + +
+ ); + } + return ( @@ -487,6 +499,7 @@ class Status extends ImmutablePureComponent { + {deepRec} {media} diff --git a/app/javascript/mastodon/features/status/components/detailed_status.js b/app/javascript/mastodon/features/status/components/detailed_status.js index b5a939dc4..a41bf9b15 100644 --- a/app/javascript/mastodon/features/status/components/detailed_status.js +++ b/app/javascript/mastodon/features/status/components/detailed_status.js @@ -91,7 +91,7 @@ export default class DetailedStatus extends ImmutablePureComponent { render () { const status = (this.props.status && this.props.status.get('reblog')) ? this.props.status.get('reblog') : this.props.status; const outerStyle = { boxSizing: 'border-box' }; - const { compact } = this.props; + const { compact, deep } = this.props; if (!status) { return null; @@ -207,6 +207,18 @@ export default class DetailedStatus extends ImmutablePureComponent { ); } + let deepRec; + if(deep != null) { + deepRec = ( +
+ + + 【】 + +
+ ); + } + return (
@@ -215,6 +227,7 @@ export default class DetailedStatus extends ImmutablePureComponent { + {deepRec} {media} diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/mastodon/features/status/index.js index 029057d40..0aa8349e8 100644 --- a/app/javascript/mastodon/features/status/index.js +++ b/app/javascript/mastodon/features/status/index.js @@ -120,14 +120,25 @@ const makeMapStateToProps = () => { const status = getStatus(state, { id: props.params.statusId }); let ancestorsIds = Immutable.List(); let descendantsIds = Immutable.List(); + let rootAcct; + let deep; if (status) { ancestorsIds = getAncestorsIds(state, { id: status.get('in_reply_to_id') }); - descendantsIds = getDescendantsIds(state, { id: status.get('id') }); + //console.log(ancestorsIds.get(0)); + const root_status = ancestorsIds.size? getStatus(state, {id: ancestorsIds.get(0)}) : status; //error is directly visit url of non-root detailedStatus, feature! + //console.log('statuese', state.get('statuses').size); + //console.log('root_status', root_status); + //console.log(root_status.get('account')); + rootAcct = root_status.getIn(['account', 'acct']); + //console.log('rootAcct', rootAcct); + descendantsIds = rootAcct == '0' ? state.getIn(['contexts', 'replies', status.get('id')]) : getDescendantsIds(state, { id: status.get('id') }); + deep = rootAcct == '0' ? ancestorsIds.size : null; } return { status, + deep, ancestorsIds, descendantsIds, askReplyConfirmation: state.getIn(['compose', 'text']).trim().length !== 0, @@ -393,14 +404,16 @@ class Status extends ImmutablePureComponent { } } - renderChildren (list) { - return list.map(id => ( + renderChildren (list, type) { + const { deep } = this.props; + return list.map((id,idx) => ( )); } @@ -436,7 +449,7 @@ class Status extends ImmutablePureComponent { render () { let ancestors, descendants; - const { shouldUpdateScroll, status, ancestorsIds, descendantsIds, intl, domain, multiColumn } = this.props; + const { shouldUpdateScroll, status, deep, ancestorsIds, descendantsIds, intl, domain, multiColumn } = this.props; const { fullscreen } = this.state; if (status === null) { @@ -449,11 +462,11 @@ class Status extends ImmutablePureComponent { } if (ancestorsIds && ancestorsIds.size > 0) { - ancestors =
{this.renderChildren(ancestorsIds)}
; + ancestors =
{this.renderChildren(ancestorsIds, 'ance')}
; } if (descendantsIds && descendantsIds.size > 0) { - descendants =
{this.renderChildren(descendantsIds)}
; + descendants =
{this.renderChildren(descendantsIds, 'desc')}
; } const handlers = { @@ -486,6 +499,7 @@ class Status extends ImmutablePureComponent {