git_integration_base.rb 539 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class GitIntegrationBase
  3. attr_reader :client, :issue_type
  4. def fix_urls_for_ticket(ticket, url_replacements)
  5. return if url_replacements.blank?
  6. issues_links = ticket.preferences.dig(issue_type, :issue_links)
  7. return if issues_links.blank?
  8. ticket.with_lock do
  9. ticket.preferences[issue_type][:issue_links] = issues_links
  10. .map { |elem| url_replacements[elem].presence || elem }
  11. .uniq
  12. ticket.save!
  13. end
  14. end
  15. end