While I'm at it, I think it's unnecessary to display the revision log on node creation. The attached patch handles that.

I'm not entirely sure I've done the check in the "correct" way, so feel free to let me know if that's true. Also, I suspect that I need to add the proper testing for this to go through, which I'll have to do later, since I'm running /way/ late, and why I'm marking this as CNW.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pasqualle’s picture

why do you think it is unnecessary?

oadaeh’s picture

I think it's unnecessary because an initial post doesn't have a revision and providing a form for one can be misleading and confusing to people who are new to adding content in Drupal.

It's certainly not a big deal if it doesn't get in, as it's just a bit of a clean up user interface.

oadaeh’s picture

Status: Needs work » Needs review
FileSize
953 bytes

Updating for the 1 line offset, and changing status.

Pasqualle’s picture

initial post doesn't have a revision

Maybe the "Create new revision" checkbox is unnecessary but the "Log message" is useful (and is used) even at node creation, and as I see you are trying to hide both..

Status: Needs review » Needs work

The last submitted patch failed testing.

desbeers’s picture

Title: Don't show the revision log when a node is being created . . . » Don't show the revision checkbox when a node is being created
Category: feature » bug
Status: Needs work » Needs review
FileSize
2.37 KB

I also find the log message useful for new content, but the checkbox should not be there when creating new nodes. Only problem is that the helptext underneath the textarea is a bit confusing in that case, you're not 'making changes'.

Found some more 'log issues' related to the book.module:

1 - The log-field is not shown if the user has no 'node-administrator' permission and editing a node in the book-outline. The $node->revision is set to '1' in book_node_presave and that's too late. Moved this to book_node_prepare(). Had to change #access and add #disabled in the 'revision-form' in node_form() to show the proper status in the tab when a new revision is forced.

2 - A check in book_node_presave() if $node->log is set is not necessary because node_save() will check that already. Removed it from book_node_presave().

I set the status to 'bug report' because of item 1.

pp’s picture

I reviewed this patch.
I don't know how reproduce the bug.

Add authenticated user role "create book" permission and all permissions which book module add the system.
Log in simple user and add book page.

When I add the book page i show:
# Notice: Undefined index: programmed in _form_builder_handle_input_element() (line 1107 of /home/pp/munka/drupal-cvs/includes/form.inc).
# Notice: Undefined index: programmed in _form_builder_handle_input_element() (line 1107 of /home/pp/munka/drupal-cvs/includes/form.inc).
# Notice: Undefined index: programmed in _form_builder_handle_input_element() (line 1107 of /home/pp/munka/drupal-cvs/includes/form.inc).
# Notice: Undefined index: programmed in _form_builder_handle_input_element() (line 1107 of /home/pp/munka/drupal-cvs/includes/form.inc).
# Notice: Undefined index: programmed in _form_builder_handle_input_element() (line 1107 of /home/pp/munka/drupal-cvs/includes/form.inc).
...

I don't know is this bug or other?

desbeers’s picture

Those notices came from #322344: (notice) Form improvements from Views and are not created because of this patch.

Bojhan’s picture

What about not showing a checkbox, and only filling it in when you want to - thereby creating a revision,

desbeers’s picture

It's a very good idea but a few points:

  • It needs some good explanation. The 'checkbox' makes it very clear: 'I want a new revision'. A textarea doesn't.
  • If you edit a node in the book-outline and you have no 'administer nodes' permission a new revision is forced by design. With your suggestion that means a 'log' is required too (and that's good in my opinion). But how to make that clear too? Especially with the new tabs, you can't expand a fieldset (eg tab) now by default with a red '*'.

I'll give it a try Bojhan, thanks for the suggestion!

Bojhan’s picture

No, but what about if it is empty we simply do nothing to the DB (like we do now, without the checkbox marked). And when someone did enter something - it creates a revision. I think it will make more sense, then showing a create revision checkbox. I am unsure if it is apperant that one does not need to fill this out, but it is not marked required.

cburschka’s picture

Status: Needs review » Needs work

I'm concerned about mixing a database decision as momentous as determining whether to use revisions or overwrite, with a field essentially intended for comments. You don't see CVS creating new branches based on what you put in the commit message. ;) It would be highly confusing, especially if you were in the habit of creating revisions on your single-user site withou leaving log messages.

This patch forces a new revision on ever node type for non-administrators when book is enabled. Regardless of whether the node in question is part of a book hierarchy or not.

  if (empty($node->book) && (user_access('add content to books') || user_access('administer book outlines'))) {
    //...
  }
  else {
    // You enter this branch if the user can neither administer books nor add content to them.
    if (!user_access('administer nodes')) {
      // You force a revision on this node even though it has nothing to do with book.module.
      $node->revision = 1;
    }
    // Witness that even the rest of the code still checks whether a book is even attached.
    if (isset($node->book['bid']) && !isset($node->book['original_bid'])) {
      $node->book['original_bid'] = $node->book['bid'];
    }
  }
DarkLight’s picture

Status: Needs work » Needs review

#6: node-book-log-1.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, node-book-log-1.patch, failed testing.

not_Dries_Buytaert’s picture

I submitted the same issue for D6: http://drupal.org/node/915766

thoughtcat’s picture

I agree that it is confusing for editors to get a field at the bottom of the submit form saying "Provide an explanation of the changes you are making" when they are first creating a node. You're not making any changes. I don't want to turn off "create new revision" for the content type because that turns off the log message field for when you are making changes. This doesn't make sense to me!

bleen’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs work » Needs review
Issue tags: +#d8ux
FileSize
1.06 KB

This has driven me nuts for years ...

I believe that we shouldn't display the revision tab at all when creating a new node. This patch does exactly that. Lets see what testbot thinks.

Status: Needs review » Needs work

The last submitted patch, 308820.patch, failed testing.

Bojhan’s picture

I agree, the patch seems to fail.

bleen’s picture

Status: Needs work » Needs review
FileSize
2.24 KB

This should pass ... I changed the "preview" test to test when editing a node instead of creating a node so that the revision log could still be tested on preview

Pancho’s picture

Status: Needs review » Needs work
Issue tags: +Needs backport to D7

In D8, we'll probably get a completely new interface for node creation. So if we fix this, then mostly in respect to D7.
There again we need to be extra careful before removing used functionality. So removing the log on node creation might break existing workflows. The checkbox should go though.
However, the patch obviously doesn't apply anymore.

bleen’s picture

Status: Needs work » Needs review
Issue tags: -#d8ux, -Needs backport to D7

#20: 308820.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +#d8ux, +Needs backport to D7

The last submitted patch, 308820.patch, failed testing.

Pancho’s picture

Status: Needs work » Needs review
FileSize
1.89 KB

A quick, untested patch without test coverage.

Pancho’s picture

Issue tags: +Needs tests

Needs to be thoroughly checked, as it doesn't seem to be covered by any test.

drumm’s picture

Issue summary: View changes
Issue tags: +affects drupal.org
Related issues: +#2127375: Hide 'Revision log message' field on node/add/*
mgifford’s picture

Status: Needs review » Needs work

Patch no longer applies.

mgifford’s picture

Status: Needs work » Needs review
FileSize
2.19 KB

core/modules/node/lib/Drupal/node/NodeFormController.php no longer exists. I assume this is now provided in:

core//modules/node/lib/Drupal/node/NodeForm.php

EDIT: I probably shouldn't have included $form['log'] but who writes log messages on a new node?

Status: Needs review » Needs work

The last submitted patch, 28: 308820-28.patch, failed testing.

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.

Berdir’s picture

Status: Needs work » Closed (duplicate)