Skip to content

Fixes #39175 - Unlock a clone of webhook template#98

Merged
adamruzicka merged 1 commit intotheforeman:masterfrom
lhellebr:fixes_39175
Mar 31, 2026
Merged

Fixes #39175 - Unlock a clone of webhook template#98
adamruzicka merged 1 commit intotheforeman:masterfrom
lhellebr:fixes_39175

Conversation

@lhellebr
Copy link
Copy Markdown
Contributor

Cloning a webhook template resulted in a clone being locked. It should be unlocked. Fixed by setting locked=false before saving.

@lhellebr lhellebr changed the title Fixes #39175 - Cloning a locked webhook template via Hammer creates a locked clone Fixes #39175 - Unlock a clone of webhook template Mar 24, 2026
Copy link
Copy Markdown
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this, just let me know if you want to address that one nitpick or not

Comment thread test/controllers/api/v2/webhook_templates_controller_test.rb Outdated
def clone
@webhook_template = @webhook_template.dup
original = @webhook_template
@webhook_template = original.dup
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to discard taxonomy associations, but that wasn't introduced here so I'd be willing to leave it for a later issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

A cloned webhook template should be unlocked even though the original
was locked - that is one of the primary reasons to clone.
Additionally, set cloned_from correctly.
@adamruzicka adamruzicka merged commit 8d4fba6 into theforeman:master Mar 31, 2026
12 checks passed
@adamruzicka
Copy link
Copy Markdown
Contributor

Thank you @lhellebr !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants