Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch created an issue. See original summary.

yoroy’s picture

Issue tags: +DevDaysMilan

I *suspect* this should be relatively easy to jump into and write a patch for.

So the task is: don't show the "Create new revision" checkbox on the content creation form

kamalrajsahu21’s picture

On first time checking the node revision checkbox and saving the node, shows a new tab "Revisions". If we again edit the same node and do not check the revision checkbox then this node update entry would not be saved in the node_revision table and hence will not be shown under "Revisions" tab.

lucur’s picture

Assigned: Unassigned » lucur
katzilla’s picture

Assigned: lucur » katzilla
biancajs’s picture

Assigned: katzilla » biancajs
biancajs’s picture

Assigned: biancajs » Unassigned
Status: Active » Needs review
Issue tags: +sprint
FileSize
1.47 KB

Hide revision checkbox on node add form by checking if node is new.

Gábor Hojtsy’s picture

@kamalrajsahu21: right, but what about the first revision, how could you skip that? :)

kamalrajsahu21’s picture

@Gábor Hojtsy: We can't skip that as this will be needed for first time just for backup of node.

Gábor Hojtsy’s picture

"We can't skip that as this will be needed for first time just for backup of node." Can you explain what would be different step by step for the two cases, I am afraid I am not getting it.

yoroy’s picture

Not showing the UI bits for revisions on *initial* node creation does not mean the node can't be saved. We just don't show a part of the UI that is not relevant at that time.

catch’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/node/src/NodeForm.php
    @@ -116,7 +116,7 @@ public function form(array $form, FormStateInterface $form_state) {
    -
    +    ¶
    

    Unnecessary whitespace addition.

  2. +++ b/core/modules/node/src/NodeForm.php
    @@ -135,13 +135,17 @@ public function form(array $form, FormStateInterface $form_state) {
    +    }
    

    For form alters etc. it's more predictable to do $form['revision']['#access'] = !$node->isNew() than to conditionally add the declaration.

katzilla’s picture

Status: Needs work » Needs review
FileSize
637 bytes

Changed the code according to #12 - thanks for the hint.

katzilla’s picture

romainj’s picture

Should we hide the Revision log message too? It has no more purpose on node creation.

lucur’s picture

@romainj Since there is created a revision automatically on node creation the log message could be still useful.

romainj’s picture

@lucur agree even if I never use the message on new node.

katzilla’s picture

FileSize
637 bytes

Re-uploading patch because test wasn't triggered.

Gábor Hojtsy’s picture

Issue tags: +Needs tests

Looks good. Needs tests AFAIS.

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

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now 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.

katzilla’s picture

Status: Needs review » Needs work
Issue tags: +Dublin2016

ok, working on a test now.

dietmarg’s picture

Assigned: Unassigned » dietmarg

working on it with katzilla

dernetzjaeger’s picture

Assigned: dietmarg » dernetzjaeger
dernetzjaeger’s picture

Status: Needs work » Needs review
FileSize
1.66 KB

Worked on that with @katzilla and @dietmarg at DrupalCon Dublin mentored by @chipway. :)

We added the simpletest in NodeCreationTest.php to the patch as @gábor-hojtsy suggested.

chipway’s picture

Thank you for the past couple of patches.

Could you provide an interdiff between the patches from #13 to #24? An interdiff helps reviewers look at the changes between patches and makes it easier to check the intended changes from what you worked on.

dernetzjaeger’s picture

FileSize
712 bytes

Sure @chipway :)

chipway’s picture

Thank you @katzilla, @dernetzjaeger and @dietmarg for you work.

I tested node_add_form_shows-2744877-24.patch following https://www.drupal.org/patch/review. Here are my findings and suggestions:

Patch addresses the issue (see screenshots) and stays within scope of the issue, and added simpletest seems accurate.

Could you delete the 6 last lines which are out of scope?
diff --git a/sites/default/default.services.yml b/sites/default/default.services.yml
old mode 100644
new mode 100755
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
old mode 100644
new mode 100755

To make this patch more comprehensive, I would suggest to remove the "Revision log message" field. See Create_Article_Drupal_-_2016-10-04_21.40.27_without-patch-2744877-24_suggestion.png

dernetzjaeger’s picture

Status: Needs work » Needs review
FileSize
1.43 KB
712 bytes

Removed the last lines. Don't know why that got into the patch. As I usually set git config core.fileMode false.

I added patch + interdiff again. :)

Thanks for the suggestion to also remove the log message input in that patch. But in my eyes it shouldn't. As in #15 and #16, I would prefer a further discussion on that in a new issue and set that one as related.

Gábor Hojtsy’s picture

Wording issue with the assertion:

+++ b/core/modules/node/src/Tests/NodeCreationTest.php
@@ -72,6 +72,12 @@ function testNodeCreation() {
+    $this->assertNoFieldById('edit-revision', NULL , 'The revision field is present.');

is not present :)

Is there a positive test that it is present later on? (I would assume there is a UI test for that, but not sure).

Gábor Hojtsy’s picture

Status: Needs review » Needs work
chipway’s picture

Thanks @Gábor Hojtsy for your help,
What is your advice about hiding "Revision log message" field in this issue or discussing this point in a new related issue?

Gábor Hojtsy’s picture

I think a different issue would be good for that. You may still want to provide a log message for your first revision, I think that makes sense in some situations, so better discussed in a separate issue. On the other hand the first revision is a new revision anyway, so the checkbox is truly pointless :)

chipway’s picture

Thanks @Gábor,

I added issue https://www.drupal.org/node/2811549 to discuss the opportunity to hide "Revision log message" field when we create a new node.
So we can go ahead with the current issue.

dernetzjaeger’s picture

Assigned: dernetzjaeger » Unassigned
Status: Needs work » Needs review
FileSize
1.44 KB

Thanks @gábor-hojtsy, changed wording.

Gábor Hojtsy’s picture

Ok, what about my other note in #29?

Is there a positive test that it is present later on? (I would assume there is a UI test for that, but not sure).

katzilla’s picture

We checked, but there was no test. Added test in NodeEditFormTest.php now.

chipway’s picture

I tested node_add_form_shows-2744877-36.patch following https://www.drupal.org/patch/review.
Patch applies on 8.3.X, addresses the issue (see screenshots still valid) and stays within scope of the issue. Added test in NodeEditFormTest.php seems to address comment #35.
I read the patch and looks clean.

chipway’s picture

To be comprehensive and fussy, PHP CodeSniffer gives few Errors in your patch:
FILE: .../core/modules/node/src/Tests/NodeEditFormTest.php
116 | ERROR | [x] Concat operator must be surrounded by a single space
117 | ERROR | [x] Space found before comma in function call
Would suggest changing them to:
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertFieldById('edit-revision', NULL, 'The revision field is present.');

katzilla’s picture

added a new patch - thanks for the hint :)

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Looks good to me, has all the tests needed, nice little usability improvement :)

katzilla’s picture

yay - that was quick in the end! Thank you :)

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Looks like a nice little usability improvement, thank you!!

Reviewed on weekly UX meeting, and committed and pushed to 8.3.x. Thanks!

  • webchick committed 8dc87c9 on 8.3.x
    Issue #2744877 by katzilla, dernetzjaeger, biancajs, chipway, Gábor...
Gábor Hojtsy’s picture

Issue tags: -sprint

Yay, congrats all!

Status: Fixed » Closed (fixed)

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