Skip to content

Scratch.parent should return Scratch.family if Scratch.family != Scratch.slug #1852

@mkst

Description

@mkst

If we have the following:

Parent 1 (slug=foo, parent=null, family=foo)
└── Child 1 (slug=bar, parent=foo, family=foo)
    └── Child 2 (slug=baz, parent=bar, family=foo)

And Child 1 is deleted. We will set Child 2's parent=null. This will mean when we return the opengraph image for Child 2 it won't look like it was forked from anywhere.

We could update the Scratch serializer to return the parent if Scratch.parent is None and Scratch.slug != Scratch.family which would show something more accurate.

Obviously if we had more children and deleted a middle-node, the children would be pointing to the ultimate parent rather than an intermediate parent, but I think that's fine (no point trying to traverse the hierarchy to set the most-correct parent, we can simply take the top ancestor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions