Steps to reproduce:
1) Add a new triggered rule, event "After saving new content"
2) Add an action "Publish content"
3) Clone this rule and change the event to "After updating existing content"
4) Edit the cloned rule, edit the action and save it without changes
5) The label has now the strange name "Publish created updated content"
6) Edit and save the action again, the label is now "Publish created updated updated content"
...

But the label should just be "Publish updated content"

CommentFileSizeAuthor
#3 rules-552218.patch805 bytesklausi
#2 rules-552218.patch1.08 KBklausi

Comments

klausi’s picture

Title: Bug: Label callback does not work correctly after cloning » Bug: Label callback does not work correctly for core actions
Component: User Interface » User interface

OK, this actually isn't related to cloning, but to rules_core_node_label_callback()

Shorter to reproduce:
1) Add a new triggered rule, event "After saving new content"
2) Add an action "Publish content"
4) Edit the action and save it without changes
5) The label has now the strange name "Publish created created content"
6) Edit and save the action again, the label is now "Publish created created created content"

klausi’s picture

Status: Active » Needs review
Issue tags: +gsoc:rulesmonkey
StatusFileSize
new1.08 KB

Here is a patch that partially fixes the issue: if the label already contains the name of the content variable (e.g. "created content"), then no str_replace() is done to the label.

This does not work if the content variable is changed (e.g. from "updated content" to "unchanged content"), where the bug is still present.

Maybe we should think about just removing the label callback from rules and leaving "content" unchanged.

klausi’s picture

StatusFileSize
new805 bytes

Urgs, this is just a simple call by reference bug: a '&' was missing, so any savings to $element['#info']['label_skeleton'] had no effect. Thx to fago for pointing out that possibility.

New patch attached, adds only one character :-)

fago’s picture

Status: Needs review » Fixed

ugh, thanks for tracking this down. I added a comment why we need the reference there and committed it.

Status: Fixed » Closed (fixed)
Issue tags: -gsoc:rulesmonkey

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