|
|
|
@ -82,9 +82,9 @@ const makeMapStateToProps = () => {
|
|
|
|
|
const getDescendantsIds = createSelector([
|
|
|
|
|
(_, { id }) => id,
|
|
|
|
|
state => state.getIn(['contexts', 'replies']),
|
|
|
|
|
], (statusId, contextReplies) => {
|
|
|
|
|
let descendantsIds = Immutable.List();
|
|
|
|
|
descendantsIds = descendantsIds.withMutations(mutable => {
|
|
|
|
|
state => state.get('statuses'),
|
|
|
|
|
], (statusId, contextReplies, statuses) => {
|
|
|
|
|
let descendantsIds = [];
|
|
|
|
|
const ids = [statusId];
|
|
|
|
|
|
|
|
|
|
while (ids.length > 0) {
|
|
|
|
@ -92,7 +92,7 @@ const makeMapStateToProps = () => {
|
|
|
|
|
const replies = contextReplies.get(id);
|
|
|
|
|
|
|
|
|
|
if (statusId !== id) {
|
|
|
|
|
mutable.push(id);
|
|
|
|
|
descendantsIds.push(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (replies) {
|
|
|
|
@ -101,9 +101,19 @@ const makeMapStateToProps = () => {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let insertAt = descendantsIds.findIndex((id) => statuses.get(id).get('in_reply_to_account_id') !== statuses.get(id).get('account'));
|
|
|
|
|
if (insertAt !== -1) {
|
|
|
|
|
descendantsIds.forEach((id, idx) => {
|
|
|
|
|
if (idx > insertAt && statuses.get(id).get('in_reply_to_account_id') === statuses.get(id).get('account')) {
|
|
|
|
|
descendantsIds.splice(idx, 1);
|
|
|
|
|
descendantsIds.splice(insertAt, 0, id);
|
|
|
|
|
insertAt += 1;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return descendantsIds;
|
|
|
|
|
return Immutable.List(descendantsIds);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state, props) => {
|
|
|
|
|