Problem/Motivation

When a node had two revisions and one is deleted, the tab shows still.
With only one revision present, the tab is removed.

In this case if you click on compare, there will be php errors.

Proposed resolution

Remove the tab in the case described.
Or make it always appear and deal with the situation that only one revision can be there.

Regarding the UX i would expect that i can access the revision tab always and learn about stored revisions.

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lhangea’s picture

FileSize
4.51 KB

Yea, I also think that here the better solution would be to keep the tab visible always even if there's only one revision left.
I found a similar proposed solution here: https://www.drupal.org/node/808730

I think that it's not Diff's job to show hide that tab, it's core's job to do that but until this is solved I wrote a patch that makes sure that no matter the case we will not have any errors thrown by the diff. More specifically when there's only one revision there's no possibility to compare it since there's nothing to compare it to.

lhangea’s picture

Status: Active » Needs review
lhangea’s picture

miro_dietiker’s picture

Status: Needs review » Needs work

I'm confused. I can't update the issue #808730 referred by lhangea. It seems to be in a special / invalid state...
What a pity. We should push this core issue forward to allow us a nice revision/diff experience.

Patch looks fine. (Not applied, not ran tests)
Created a ticket to push maintainers to enable the 8.x testbot... #2452517: Enable testbot for 8.x branch

With fixing we should also extend the tests to go to the revisions table after deleting revisions. I think it's even a commented out part of our tests.

miro_dietiker’s picture

Title: Revision tab visible with only one revision » Node revision tab visible with only one revision
miro_dietiker’s picture

The core issue is now editable again. I added a comment with the reference.

miro_dietiker’s picture

Status: Needs work » Needs review

Make the bots test this patch.

miro_dietiker’s picture

The code above should fix the issue. We still should extend the test to generate the error condition.

lhangea’s picture

FileSize
1.08 KB
5.59 KB

Added tests to verify that the comparison feature is disabled when there is only 1 revision.

miro_dietiker’s picture

Uploading the test adding as test-only patch... so we see the testbot fail. :-)

Status: Needs review » Needs work

The last submitted patch, 10: diff_2424249_revision_9_test-only.patch, failed testing.

miro_dietiker’s picture

Status: Needs work » Reviewed & tested by the community

Very nice! Thx.

  • lhangea committed d5d0daf on 8.x-1.x
    Issue #2424249 by lhangea: Node revision tab visible with only one...
lhangea’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.