Problem/Motivation

Reproduce:
1. Apply this patch #2350309: Forum index links head to taxonomy/term/{term} instead of forum/{term} or goto forum/1
2. Add a forum topic
3. Edit a forum topic, select moving to another Forums, and Ticked "Leave shadow copy"

Result:
Forum topic moved. No shadow copy in original forum.

Expected:
Forum topic moved. and Leaving a shadow copy with link in original forum.

Proposed resolution

Remaining tasks

User interface changes

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug because functionality was lost in NodeNG conversion (with follow-up #1956848: NodeNG conversion follow-up: Only first forum tid is saved into {forum_index})
Issue priority Major because loss of functionality/regression

API changes

Issue fork drupal-2390065

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan’s picture

Issue tags: +Needs tests

Not sure it's major

David_Rothstein’s picture

Title: Error when moving a forum topic with "Leave shadow copy" » "Leave shadow copy" option when moving a forum topic doesn't work at all

Might want to coordinate any tests here with #1578998: move forum topic and leave shadow cause duplicated topics show in list, as that one was noted as needing tests also.

lokapujya’s picture

In forum_node_presave(), $node->shadow doesn't exist. I think the checkbox (which is added in form_alter) needs to be handled differently.

lokapujya’s picture

In D7, the form_alter passed properties to the $node object in hook_node_presave(). D8 has hook_ENTITY_TYPE_presave() which passes in an entity interface. Is there a way to pass a value from a form to hook_ENTITY_TYPE_presave() in D8? or another way to try to fix it?

lokapujya’s picture

Title: "Leave shadow copy" option when moving a forum topic doesn't work at all » Moving a forum with "Leave shadow copy" checked should leave a copy in the original forum
larowlan’s picture

Assigned: Unassigned » larowlan
larowlan’s picture

Assigned: larowlan » Unassigned
Status: Active » Needs review
Issue tags: -Needs tests
FileSize
1.27 KB
4.68 KB

The last submitted patch, 7: forum-shadow-2390065.fail_.patch, failed testing.

lokapujya’s picture

Looks good to me. Thank You larowlan for showing me the new way to pass the form values! How did you know about that! I will link to the change request for other readers: https://www.drupal.org/node/2420295. I think the shadow copy should show the title since it showed in D7; So I made that change and added a test since it was broken a long time ago.

Do we want the #entity_builder callback as it is now, as opposed to a #submit callback?

The last submitted patch, 9: 2390065-9-test-only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 9: interdiff-2390065-9.patch, failed testing.

lokapujya’s picture

redo test-only patch which did not apply. It needed to be applied on top of #7.

lokapujya’s picture

Status: Needs work » Needs review

The last submitted patch, 12: 2390065-12-test-only.patch, failed testing.

jhedstrom’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
rpayanm’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
5.34 KB
4.77 KB

Status: Needs review » Needs work

The last submitted patch, 16: 2390065-16-test-only.patch, failed testing.

jhedstrom’s picture

Status: Needs work » Needs review
Issue tags: +Needs beta evaluation

Back to needs review since it was the test-only patch that failed.

larowlan’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Looks good to me, added beta eval

catch’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/forum/forum.module
@@ -158,6 +159,7 @@ function forum_node_presave(EntityInterface $node) {
+          $node->setNewRevision(TRUE);

Do we explicitly need to set this? Do the tests actually fail without it? Can't see why so needs a comment if that's the case.

larowlan’s picture

Status: Needs work » Needs review
Issue tags: -Needs beta evaluation
FileSize
894 bytes
5.47 KB

Added comment explaining reason this:

We need a new revision because {forum} table has a primary key of vid. You can *never* have two terms for the same revision, so not sure how 'shadow' ever worked. It was before my time maintaining forum. Forcing the new revision is simplest fix, avoids schema changes.

In all honesty my preference would be to just drop the whole 'shadow' feature.

larowlan’s picture

Digging back through old logs. forum_schema had a PK on vid even when it was in forum.schema (i.e. before hook_schema got moved to .install files). That was in 2007.

So I figured, OK, perhaps forum always created new revisions and this got missed in the hook_node_info » node.type.forum.yml conversion. But nope, it didn't have revisions on before then either.

So maybe this never worked. Who knows.

fubhy’s picture

If it never worked and noone noticed, maybe it's a good opportunity to remove it for realz? :)

larowlan’s picture

There are a few bugs, probably some are duplicates/resolved once this is in.

https://www.drupal.org/project/issues/drupal?text=shadow&component=forum...

catch’s picture

Assigned: Unassigned » webchick

It worked in 2005/6 but it's possible it hasn't worked since. I do vaguely remember us breaking then fixing it once before more recently than that though.

I don't think anyone will miss this, assiging to webchick for a product decision.

webchick’s picture

I haven't seen this feature in active use since like 2008, so definitely would not cry at its loss.

I would have two questions though which is:

1) what's the impact on sites (such as Drupal.org) that do have shadowed forum topics? Do the topics start showing up in both places?
2) Is contrib able to add this functionality back for sites that need it?

lokapujya’s picture

reroll.

Michelle’s picture

For those saying this never worked, I know it was working back when I was actively working on AF a few years ago and I used it on the forum I ran. It's nice when you move a post for the person who posted to be able to see where it went to.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

larowlan’s picture

Version: 8.3.x-dev » 8.4.x-dev

Re-reviewed this, happy with the approach in lieu of dropping functionality, which is definitely out now.

Can't RTBC because I worked on the patch, maybe @Michelle can?

andypost’s picture

Patch needs short array code syntax

  1. +++ b/core/modules/forum/forum.module
    @@ -445,7 +459,7 @@ function template_preprocess_forums(&$variables) {
    -          $variables['topics'][$id]->title = $topic->getTitle();
    +          $variables['topics'][$id]->title_link = $topic->getTitle();
    

    this change looks strange or out of scope

  2. +++ b/core/modules/forum/src/ForumIndexStorage.php
    @@ -85,10 +85,23 @@ public function deleteRevision(NodeInterface $node) {
    +        ->fields(array(
    
    +++ b/core/modules/forum/src/Tests/ForumTest.php
    @@ -631,11 +631,16 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) {
    +      $forum_tids = db_query("SELECT tid FROM {forum} WHERE nid = :nid", array(
    

    needs reroll for short array

Vidushi Mehta’s picture

Issue tags: -Needs reroll
FileSize
5.54 KB

Was unable to apply patch on local on 8.4.x, So i have rerolled the patch #27

pk188’s picture

Status: Needs work » Needs review

.

pk188’s picture

Vidushi Mehta’s picture

@pk188 Do you have anything specific related to #34. Because i don't know why you have deleted the patch file, as there was no such comment or something.
Let me know the improvements, If any.

pk188’s picture

@Vidushi Mehta I had made the patch and uploaded after few seconds of you, so by mistake your patch deleted by me. According to me there are no improvements.

andypost’s picture

#33.1 still a question

Vidushi Mehta’s picture

@andypost can u please describe what is left or incorrect.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

JvE’s picture

Status: Needs review » Needs work

The last submitted patch, 44: forum-shadow-2390065-44.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

JvE’s picture

longwave’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 46: forum-shadow-2390065-46.patch, failed testing. View results

andypost’s picture

so only needs to fix a test

1) Drupal\Tests\forum\Functional\ForumTest::testForum
The forum topic is linked to a different forum and the shadow remains
Failed asserting that an array is empty.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

jaapjan’s picture

I've added a new patch for Drupal 9.2.x.

I assume the test will still need to be fixed so leaving the issue status as is.

eelkeblok’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 57: 2390065-forum-shadow-copy-57.patch, failed testing. View results

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

Forum is approved for removal. See #1898812: [policy] Deprecate forum module for removal in Drupal 11

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

It will be moved to the contributed extension once the Drupal 11 branch is open.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

eelkeblok changed the visibility of the branch 2390065-rebase-10-2 to hidden.

eelkeblok’s picture

I took the liberty of creating an MR against Drupal 11 so folks who need a patch can get one (copy the contents of https://git.drupalcode.org/project/drupal/-/merge_requests/6674.diff to your local project and apply the patch). There was a conflict with #57 and some recent changes to the module file.