Tombstone: work for descendants, too
This commit is contained in:
parent
217fbea7a3
commit
8cdb0581d3
|
@ -411,7 +411,7 @@ class Status extends ImmutablePureComponent {
|
||||||
|
|
||||||
renderTombstone(id) {
|
renderTombstone(id) {
|
||||||
return (
|
return (
|
||||||
<div className='tombstone'>
|
<div className='tombstone' key={id}>
|
||||||
<p><FormattedMessage id='statuses.tombstone' defaultMessage='One or more posts is no longer available.' /></p>
|
<p><FormattedMessage id='statuses.tombstone' defaultMessage='One or more posts is no longer available.' /></p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -26,15 +26,22 @@ const normalizeContext = (immutableState, id, ancestors, descendants) => immutab
|
||||||
}
|
}
|
||||||
|
|
||||||
ancestors.forEach(addReply);
|
ancestors.forEach(addReply);
|
||||||
descendants.forEach(addReply);
|
|
||||||
|
descendants.forEach(status => {
|
||||||
|
if (status.in_reply_to_id) {
|
||||||
|
addReply(status);
|
||||||
|
} else {
|
||||||
|
addReply({ id: `tombstone-${status.id}`, in_reply_to_id: id });
|
||||||
|
addReply({ id: status.id, in_reply_to_id: `tombstone-${status.id}` });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (ancestors.length > 0 && !inReplyTos.get(id)) {
|
if (ancestors.length > 0 && !inReplyTos.get(id)) {
|
||||||
const tombstoneId = `tombstone-${id}`;
|
|
||||||
const { id: lastId } = ancestors[ancestors.length - 1];
|
const { id: lastId } = ancestors[ancestors.length - 1];
|
||||||
replies.update(tombstoneId, ImmutableOrderedSet(), siblings => siblings.add(id).sort());
|
replies.update(`tombstone-${id}`, ImmutableOrderedSet(), siblings => siblings.add(id).sort());
|
||||||
replies.update(lastId, ImmutableOrderedSet(), siblings => siblings.add(tombstoneId).sort());
|
replies.update(lastId, ImmutableOrderedSet(), siblings => siblings.add(`tombstone-${id}`).sort());
|
||||||
inReplyTos.set(id, tombstoneId);
|
inReplyTos.set(id, `tombstone-${id}`);
|
||||||
inReplyTos.set(tombstoneId, lastId);
|
inReplyTos.set(`tombstone-${id}`, lastId);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in New Issue