Problem/Motivation

With links in paragraphs, we can end up with results from previous revisions - e.g. ` > Sidebar menu (previous revision)`.

This can make views showing broken links less useful.

Steps to reproduce

Have a broken link inside a paragraph field which is no longer the current revision.

Proposed resolution

Indicate when links are in old revisions of paragraphs, and then add a filter to remove them.

CommentFileSizeAuthor
#16 3366753-minimal.patch6.47 KBmarttir
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lazysoundsystem created an issue. See original summary.

eiriksm’s picture

Status: Active » Needs work

Thanks! ❤️

For starters, do you mind fixing up the coding standards in your Mr?

lazysoundsystem’s picture

Status: Needs work » Active

Thanks for checking and sorry for the coding standards, I was trying through gitlab's web ide for the first time, but got confused.

Still to come is a way to filter out fields with this label - and to see if the label can be worded better.

hemangi.gokhale’s picture

Assigned: Unassigned » hemangi.gokhale
Status: Active » Needs work

The patch got applied cleanly, but as per the diff at line no. 78, field name field_paragraphs is hardcoded. Need a better way of handling such a scenario.

hemangi.gokhale’s picture

Assigned: hemangi.gokhale » Unassigned
Status: Needs work » Needs review

This is ready for review.

lazysoundsystem’s picture

Thanks, this is an improvement!

paula_iuga made their first commit to this issue’s fork.

paula_iuga changed the visibility of the branch 3366753-dont-check-obsolete-paragraphs to hidden.

eiriksm’s picture

Would be super nice to have some tests for this. Would you be able to fix that do you think?

paula_iuga’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
paula_iuga’s picture

@eiriksm I will add some tests.

marttir’s picture

Status: Needs review » Needs work

Need to fix a few issues and rebase the code onto latest dev.

marttir’s picture

StatusFileSize
new6.47 KB

Sorry for uploading a patch, but MR 84 doesn't yet apply to 2.0.0 or 2.1.0-alpha, the latter of which removes the dependency on dynamic_entity_reference.

This "minimal" patch is a modified version of the MR 84 diff, and applying it on 2.1.0-alpha fixes the issue.

imclean’s picture

It would be good to filter out the outdated content. I'm using this patch with a slight change.

  if ($entity instanceof ParagraphInterface) {
      $hierarchy = [];
      $parentEntity = $this->getParentEntity($entity, $hierarchy);
      $isOutdatedParagraph = empty($parentEntity) || !$this->isReferencedInCurrentRevision($parentEntity, $hierarchy);
    }

    if ($isOutdatedParagraph) {
      return [];
    }

I don't want outdated content checked at all.