Fix parent read more occurring further up the tree
This commit is contained in:
@@ -372,16 +372,21 @@ export function sortAndAnnotateThreadItems(
|
|||||||
/*
|
/*
|
||||||
* Tree-view only.
|
* Tree-view only.
|
||||||
*
|
*
|
||||||
* If there's an upcoming parent read more, this branch is part of the
|
* If there's an upcoming parent read more, this branch is part of a
|
||||||
* last branch of the sub-tree, and the item itself is the last child,
|
* branch of the sub-tree that is deeper than the
|
||||||
* insert the parent "read more".
|
* `upcomingParentReadMore`, and the item following the current item
|
||||||
|
* is either undefined or less-or-equal-to the depth of the
|
||||||
|
* `upcomingParentReadMore`, then we know it's time to drop in the
|
||||||
|
* parent read more.
|
||||||
*/
|
*/
|
||||||
if (
|
if (
|
||||||
view === 'tree' &&
|
view === 'tree' &&
|
||||||
metadata.upcomingParentReadMore &&
|
metadata.upcomingParentReadMore &&
|
||||||
metadata.isPartOfLastBranchFromDepth ===
|
metadata.isPartOfLastBranchFromDepth &&
|
||||||
|
metadata.isPartOfLastBranchFromDepth >=
|
||||||
metadata.upcomingParentReadMore.depth &&
|
metadata.upcomingParentReadMore.depth &&
|
||||||
metadata.isLastChild
|
(metadata.nextItemDepth === undefined ||
|
||||||
|
metadata.nextItemDepth <= metadata.upcomingParentReadMore.depth)
|
||||||
) {
|
) {
|
||||||
subset.splice(
|
subset.splice(
|
||||||
i + 1,
|
i + 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user