[drupal-devel] [bug] Failure to respect node status upon editing (reverts to default)

moshe weitzman drupal-devel at drupal.org
Mon Jan 24 16:41:58 UTC 2005


 Project:      Drupal
 Version:      cvs
 Component:    node system
 Category:     bug reports
 Priority:     normal
 Assigned to:  mathias
 Reported by:  mathias
 Updated by:   moshe weitzman
 Status:       patch

this patch fixes a fairly undesirable problem with our workflow. lets
consider it along with other proposed changes to default workflow.

moshe weitzman



Previous comments:
------------------------------------------------------------------------

May 20, 2004 - 22:00 : mathias

How to recreate:

1. As admin, navigate to: administer » content » settings, and
uncheck 'publish' for stories.
2. As admin, create a story and assign it to a user that can create and
maintain their own stories, say this user's name is Mark.
3. Login as Mark and edit that story.
4. Instead of staying published, it reverts back to it's unpublished
state.

I think this behavior is a bug as these content settings are default
settings and should only be applied during node creation (not editing).
I know Drupal-contrib project owners get bitten with this everytime they
edit their project pages.

I'll work on a patch within the next day.



------------------------------------------------------------------------

May 21, 2004 - 10:59 : mathias

Attachment: http://drupal.org/files/issues/node_defaults.patch (1.05 KB)

Proposed solution:

If a node is being updated: respect the following existing settings:

1. node status (published/unpublished)
2. node promotion (promoted on front page)
3. node static (static on front page)

For any node, force the defaults for:

1. moderation
2. revisions

With our current situation, say the admin makes 'promote to front page'
and 'static on front page' the default settings for stories.  Another
user posts a story and bam! it's of course immediately visible.  The
admin decides he/she doesn't like that story and demotes it.  Well as
soon as that user edits his story, the default settings are re-assigned
and his post is right back on the front page. 

------------------------------------------------------------------------

August 3, 2004 - 14:38 : mathias

Attachment: http://drupal.org/files/issues/node_defaults_0.patch (1.19 KB)

When editing nodes, the following node properties should not be
overwritten

- node status (published/unpublished)
- node promotion (promoted on front page)
- node sticky (top of the list)

Currently, if the author of a node doesn't have 'administer node'
privileges, than the above settings will always revert to the default
behavior of their node type group. This makes nodes disappear and node
authors very very confused. 

------------------------------------------------------------------------

August 3, 2004 - 14:56 : ccourtne

Don't forget to take moderation into account.  If a node is edited
should it go back through moderation?  Some sites may want the behavior
of going back some sites may not.  This is probably best as a toggle
option on workflow default config screen.

------------------------------------------------------------------------

August 3, 2004 - 16:21 : mathias

I don't think my patch interferes with the moderation features. If the
default workflow for a type of nodes is set to 'moderate', than the
moderation flag will always reset itself to 'moderation' upon editing. 
I did not alter this functionality.

------------------------------------------------------------------------

September 29, 2004 - 17:00 : mathias

Attachment: http://drupal.org/files/issues/node_defaults_1.patch (1.64 KB)

I was recently bitten by this bug again, so I'll try to describe the
exact nature of the problem.

If an user of a node doesn't have 'administer nodes' permission, than
whenever they edit their own node the status, promotion, static,
moderation and revision settings revert to their default state. This
can cause:

- A demoted post to once again be promoted.
- A promoted post to be demoted.
- A static post to disappear from the front page.

All of these scenarios have happened to me simply by authors editing
their own content.  This patch allows all options except moderation and
revision to stay with a node once it's created. Note: along a very
similar line, the one-line 'node_validate does not respect group
editing patch [1]' has been rolled into this as well. I'll take it out
if need be.
[1] http://drupal.org/node/11071


------------------------------------------------------------------------

September 29, 2004 - 17:00 : mathias

I was recently bitten by this bug again, so I'll try to describe the
exact nature of the problem.

If an user of a node doesn't have 'administer nodes' permission, than
whenever they edit their own node the status, promotion, static,
moderation and revision settings revert to their default state. This
can cause:

- A demoted post to once again be promoted.
- A promoted post to be demoted.
- A static post to disappear from the front page.

All of these scenarios have happened to me simply by authors editing
their own content.  This patch allows all options except moderation and
revision to stay with a node once it's created. Note: along a very
similar line, the one-line 'node_validate does not respect group
editing patch [2]' has been rolled into this as well. I'll take it out
if need be.
[2] http://drupal.org/node/11071


------------------------------------------------------------------------

September 30, 2004 - 14:08 : Dries

When someone edits a node that has been promoted, I do want to demote it
from the main page.  If not, the system is open for abuse.  IMO, this is
'by design'.


------------------------------------------------------------------------

September 30, 2004 - 15:00 : Bèr Kessels

Both Dries and Mathias have valid points here.

If I add a post with loads of ugly stuff inside it, but an adminstrator
decides not to delete it (because the post is still not too bad, or
because of policy), but demote it, I can promote my spam next minute
again by simply editing my content. This is bad.

If I add a post with lots of good information, so that an administratr
promotes it, next thing i can do is open it up and add loads of ugly
spam to it.

Buth are unwanted scenarios. The first is what we have now. The second
is when this patch is committed. 

I think we need to seriously rething the workflow logic, maybe
splitting workflow up into "add" and "edit".
But maybe there are even better options? 


------------------------------------------------------------------------

September 30, 2004 - 15:01 : Bèr Kessels

Both Dries and Mathias have valid points here.

If I add a post with loads of ugly stuff inside it, but an adminstrator
decides not to delete it (because the post is still not too bad, or
because of policy), but demote it, I can promote my spam next minute
again by simply editing my content. This is bad.

If I add a post with lots of good information, so that an administrator
promotes it, next thing i can do is open it up and add loads of ugly
spam to it. and then i have a promoted post with spam on that site.

Both are unwanted scenarios. The first is what we have now. The second
is when this patch is committed. 

I think we need to seriously rething the workflow logic, maybe
splitting workflow up into "add" and "edit".
But maybe there are even better options? 


------------------------------------------------------------------------

September 30, 2004 - 15:02 : Bèr Kessels

Both Dries and Mathias have valid points here.

If I add a post with loads of ugly stuff inside it, but an adminstrator
decides not to delete it (because the post is still not too bad, or
because of policy), but demote it, I can promote my spam next minute
again by simply editing my content. This is bad.

If I add a post with lots of good information, so that an administrator
promotes it, next thing i can do is open it up and add loads of ugly
spam to it. and then i have a promoted post with spam on that site.

Both are unwanted scenarios. The first is what we have now. The second
is when this patch is committed. 

I think we need to seriously rething the workflow logic, maybe
splitting workflow up into "add" and "edit".
But maybe there are even better options? 


------------------------------------------------------------------------

September 30, 2004 - 15:11 : Dries

The first problem can be solved by blocking the user account, or by
revoking the user's permissions.

The second problem can probably be solved using the node-level
permissions.  Whenever I promote a post to the front page, I could
revoke the user's edit rights.  It would only work, if the modules
don't by-pass the access rights, of course (I believe some do).


------------------------------------------------------------------------

October 3, 2004 - 16:28 : mathias

Attachment: http://drupal.org/files/issues/node_defaults_2.patch (4.22 KB)

Dries is right about using the power of node-level permissions for
community editing. I think this patch would assist that goal.  As it
stands, node-level permissions don't work with community editing, at
least in the sense we're used to.  For one node_validate transfers
ownership of the node to the current editing user which may not always
be the author.  This causes many problems since original authorship
usually implies special privileges (e.g. 'edit own foo', delete).

Second, sites have different trust levels for users.  On some sites
there's just a handful of trusted users that edit and maintain all the
content.  The current approach for community editing is to create a new
role and give it the 'administer nodes' permission, which in my opinion
makes the node form interface much more cluttered and gives users in
that role full access to node properties. Full access is not always
desired.  Using a combination of node-level permissions and allowing a
node to retain some or all of its options makes a clean, easy to use
approach to maintainance.

This new patch lets the admin control how node_validate handles node
options during editing. It splits the default workflow screen into two
parts: Creation settings, and Editing options.  The creation settings
is the default workflow we're all used to. The editing options allow
the admin to say what happens to those node options when they are
edited.

I've created a node-level permissions module [3] based on JonBob's work
that allows a user to choose which roles can view and/or edit their
post. Unfortunately it needs this patch to allow node_validate to be a
little less controlling. I'd like to contribute this module if it
didn't need a patch.
[3] http://www.asitis.org/tmp/


------------------------------------------------------------------------

October 3, 2004 - 16:30 : mathias

Attachment: http://drupal.org/files/issues/node_defaults_admin_content.png (22.39 KB)

Screenshot of the new default 'node editing options' interface.


------------------------------------------------------------------------

October 4, 2004 - 10:16 : Bèr Kessels

Mathias,

First: using radio's for a Boolean is bad UI design IMO. It would be
much better if you use checkboxes.
Second: If you use radio's you can make the same matrix as above, for
each node-type a reset foo flag.

This will not only make the UI more consistent, but also improve
usability by allowing per-node-type reset flag.

Ber


------------------------------------------------------------------------

October 4, 2004 - 13:08 : Dries

The settings GUI's help text is rather hard-core and will scare many
user away.  It will even frighten most Drupal developers.  Also, I'm
not sure I understood the screenshot correctly.  

The functionality introduced is much needed but the GUI and
configuration parts needs work IMO.  Keep working on it.


------------------------------------------------------------------------

October 14, 2004 - 16:55 : mathias

Attachment: http://drupal.org/files/issues/node_defaults_3.patch (4.74 KB)

As per Ber's feedback, I changed the interface to use checkboxes and
allowed the reset flags to be set for each node-type.  The result is a
much more familiar and consistent experience.

Dries: I revamped the help text, removing the scary bits and sticking
to the bare essentials.

The dialog concerning this patch has been excellent, and the result of
which I feel is a sweet slice of code ready for core :)


------------------------------------------------------------------------

October 14, 2004 - 16:56 : mathias

Attachment: http://drupal.org/files/issues/node_defaults_admin_content_0.png (18.68 KB)

Latest screenshot of patch.


------------------------------------------------------------------------

October 28, 2004 - 15:08 : mathias

Attachment: http://drupal.org/files/issues/node_defaults_4.patch (4.81 KB)

Updated the help text to be slightly more descriptive, informing the
reader that: Users with "administer nodes" permission can override the
editing options.


------------------------------------------------------------------------

October 28, 2004 - 18:51 : Steven

I'm not sure I like that admin interface. My brain tries to correlate
the two tables, but the meanings are different (what is the value, keep
the value?). Maybe it would be better just to have one checkbox per node
type to allow you to either revert the
published/frontpage/moderate/sticky fields on editing, or not. This
should cover 99% of all use cases with an admin interface that is much
easier to understand.



------------------------------------------------------------------------

October 30, 2004 - 14:29 : mathias

Attachment: http://drupal.org/files/issues/node_defaults_5.patch (5.06 KB)

It provides a consistant look and feel if the creation settings are the
same as the editing settings since they both manipulate the same
components of a node and you're just toggling states based on different
actions.

I think it is a bad idea to only give site admins an 'all or none'
approach to override node options upon editing.  Here are some examples
why:

- You want nodes to remember their 'sticky' setting, but unpublish
themselves after editing. Once the node is approved, it goes right back
to where it was.

- You want nodes to remember their 'promote to front page' setting, but
unpublish themselves after editing. Once the node is approved, it goes
right back to where it was.

- You want nodes to remember all their settings except moderation. The
node is still published, but it goes into the queue to be rated again
since the content has changed.

- By default nodes are unpublished. Once it's been tagged as published
it stays that way. Perhaps the moderation tag is reset.

I've updated the code to hopefully make things even more clearer.
Here's the latest screenshot [4].
[4] http://asitis.org/tmp/node_defaults_admin_content_1.png


-- 
View: http://drupal.org/node/7940
Edit: http://drupal.org/project/comments/add/7940





More information about the drupal-devel mailing list