Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dysproseum’s picture

Created a patch to address the issue. The module will now remove a node from the prev_next_node table when it is unpublished, and reassign nodes that linked to it.

Also, when a node is published again, it will be re-added to the prev_next_node table, and become re-included in links to other content.

Testing example:

  1. Site contains 4 nodes, indexed and linked to each other
  2. Unpublish node 3
  3. Confirm that Prev/Next links are removed from node 3 page
  4. Confirm that node 2 links to node 4 and vice versa
  5. Re-publish node 3
  6. Confirm that Prev/Next links are re-added to node 3 page
  7. Confirm that node 2 again links to node 3, and node 4 links to node 3 as well
dysproseum’s picture

Status: Active » Needs review
dysproseum’s picture

dysproseum’s picture

Updated patch to unset prev_nid and next_nid values when their NID values become unpublished.
Prevents an issue that can leave links to unpublished nodes in some cases.

xumepadismal’s picture

Updated patch fixes issue when the node is being *inserted* as unpublished

tim-diels’s picture

Status: Needs review » Reviewed & tested by the community

Tested latest patch and works like expected. Good job!

The last submitted patch, 1: prev_next-2429187-node-unpublished.patch, failed testing.

The last submitted patch, 1: prev_next-2429187-node-unpublished.patch, failed testing.

The last submitted patch, 1: prev_next-2429187-node-unpublished.patch, failed testing.

The last submitted patch, 1: prev_next-2429187-node-unpublished.patch, failed testing.

The last submitted patch, 3: prev_next-2429187-node-unpublished-3.patch, failed testing.

The last submitted patch, 3: prev_next-2429187-node-unpublished-3.patch, failed testing.

The last submitted patch, 3: prev_next-2429187-node-unpublished-3.patch, failed testing.

The last submitted patch, 3: prev_next-2429187-node-unpublished-3.patch, failed testing.

The last submitted patch, 4: prev_next-2429187-node-unpublished-4.patch, failed testing.

The last submitted patch, 4: prev_next-2429187-node-unpublished-4.patch, failed testing.

The last submitted patch, 4: prev_next-2429187-node-unpublished-4.patch, failed testing.

The last submitted patch, 4: prev_next-2429187-node-unpublished-4.patch, failed testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 5: prev_next-node_unpublished-2429187-5.patch, failed testing.

The last submitted patch, 5: prev_next-node_unpublished-2429187-5.patch, failed testing.

The last submitted patch, 5: prev_next-node_unpublished-2429187-5.patch, failed testing.

The last submitted patch, 5: prev_next-node_unpublished-2429187-5.patch, failed testing.

Rob C’s picture

Needs reroll.

checking file prev_next.module
Hunk #1 succeeded at 255 with fuzz 1.
Hunk #2 succeeded at 263 with fuzz 2.
Hunk #4 FAILED at 349.
1 out of 5 hunks FAILED
marttir’s picture

The patch from #2774825 would conflict with the one in #5.

Since I'm in a bit of a hurry, I took the liberty of rolling both up into this patch against current 2.x-dev.

The first and second hunks of #5 were skipped; the second one seems to do what _prev_next_modify_pointing_nodes() already did, but with reverse lookup. Reviewer might want to take an extra look at this just to make sure.

With quick testing, references are updated as expected when unpublishing/publishing nodes in the middle of a chain, when adding a new node at the end of the chain, and when adding a published node in the middle of the chain.

marttir’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 24: prev_next-node_unpublished-2429187-24.patch, failed testing.

The last submitted patch, 24: prev_next-node_unpublished-2429187-24.patch, failed testing.

The last submitted patch, 24: prev_next-node_unpublished-2429187-24.patch, failed testing.

The last submitted patch, 24: prev_next-node_unpublished-2429187-24.patch, failed testing.

pribeh’s picture

Hi, thanks for your efforts here. Have you been able to incorporate any of @dysproseum's efforts into this patch?

https://www.drupal.org/node/2464065

marttir’s picture

#24 includes @dysproseum's efforts from this issue, as well as @ethan.han777's efforts from #2774825.

@dysproseum's cron patch from #2464065 is not included here as it's kind of an unrelated issue: links to unpublished nodes should never occur with #24, but they may happen if other modules use too much magic when publishing/unpublishing nodes. Also, since the cron patch only adds a bit of code, rerolling it seems straightforward.

marttir’s picture

Status: Needs work » Needs review