summaryrefslogtreecommitdiff
path: root/app/models/hooks/web_hook.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/hooks/web_hook.rb')
-rw-r--r--app/models/hooks/web_hook.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/hooks/web_hook.rb b/app/models/hooks/web_hook.rb
index 946cdda2e75..639fe138a46 100644
--- a/app/models/hooks/web_hook.rb
+++ b/app/models/hooks/web_hook.rb
@@ -41,6 +41,7 @@ class WebHook < ApplicationRecord
after_initialize :initialize_url_variables
before_validation :reset_token
+ before_validation :reset_url_variables, unless: ->(hook) { hook.is_a?(ServiceHook) }
before_validation :set_branch_filter_nil, \
if: -> { branch_filter_strategy_all_branches? && enhanced_webhook_support_regex? }
validates :push_events_branch_filter, \
@@ -224,6 +225,10 @@ class WebHook < ApplicationRecord
self.token = nil if url_changed? && !encrypted_token_changed?
end
+ def reset_url_variables
+ self.url_variables = {} if url_changed? && !encrypted_url_variables_changed?
+ end
+
def next_failure_count
recent_failures.succ.clamp(1, MAX_FAILURES)
end