I noticed that sometimes, after I edit a node, the confirmation message is displayed twice like this:

"Your changes are now current as moderation is switched off for this content type.
Your changes are now current as moderation is switched off for this content type."

Comments

rdeboer’s picture

Hi Daniel,
Thanks for reporting this.
Bit puzzled about this one...
Can you say anything about the conditions under which this "sometimes" happens?
Rik

dboulet’s picture

I'll have to investigate further to find the conditions under which this happens. Am I the only one having this issue?

crea’s picture

Hmmmmm, first guess:
This is probably problem with hook_nodeapi('update') running twice and Revisioning not checking that. Let me explain.
When one uses stuff like core actions (+Trigger ?) or some modules like Rules or Workflow, hook_nodeapi('update') can run more than once during single request. As I see Revisioning stores data in $node->revision_moderation so that data may be interpreted more than once.
I faced similar problems with Workflow module: when you use same $node object its passed by reference so one needs to clear any $node object modifications that are used to define behavior logics, before you invoke any code that could invoke additional hook_nodeapi('update') runs. See #472966: Avoid execute_transition twice (when using Rules, Actions) for example of similar problem.

In short, do you use actions or Rules/Workflow module ? If you have any action that updates the node (and triggering Workflow state change does that) that is probably the case. Try disabling that action to see if it solves the problem.

dboulet’s picture

Yes, I think you're exactly right crea, I have triggers that work with Workflow states to publish nodes. I guess this isn't really a bug with Revisioning then—it only displays the message twice because the node is essentially updated twice.

crea’s picture

This *is* bug with Revisioning. When using hook_nodeapi('update') developer should by default accept the fact it may be run more than once.
Not only double messages are ugly, but also second message doesn't make any sense since it's programmed run without human invervention.

crea’s picture

Status: Active » Needs review

Find this line:

drupal_set_message(t('Your changes are now current as moderation is switched off for this content type.'), 'warning');

and change to:

drupal_set_message(t('Your changes are now current as moderation is switched off for this content type.'), 'warning', FALSE);

I think it should fix the problem.

rdeboer’s picture

Good one!
I had forgotten about that repeat-suppression parameter on drupal_set_message(....);

dboulet’s picture

StatusFileSize
new726 bytes

Thanks crea, I never even realized that the parameter existed!

Here's a proper patch to help people test.

Are there any other messages that would require repetition suppression? I had only noticed the one.

rdeboer’s picture

Thanks crea, dboulet. It's in the dev snap shot.

rdeboer’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

markabur’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new730 bytes

Something on my site is firing 'alter' twice, and I'm seeing similar repeated messages, e.g. "Displaying current, published revision of...". Patch attached adds FALSE as above.

-        drupal_set_message(_revisioning_node_info_msg($node));
+        drupal_set_message(_revisioning_node_info_msg($node), 'status', FALSE);
rdeboer’s picture

Status: Needs review » Closed (fixed)