<commit_before># Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/

class Observer::Ticket::RefObjectTouch < ActiveRecord::Observer
  observe 'ticket'

  def after_create(record)
    ref_object_touch(record)
  end
  def after_update(record)
    ref_object_touch(record)
  end
  def after_touch(record)
    ref_object_touch(record)
  end
  def after_destroy(record)
    ref_object_touch(record)
  end

  def ref_object_touch(record)

    # return if we run import mode
    return if Setting.get('import_mode')
    if record.customer
      record.customer.touch
    end
    if record.organization
      record.organization.touch
    end
  end
end<commit_msg>To prevent loops, do not trigger touch on touch (just on real change).<commit_after># Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/

class Observer::Ticket::RefObjectTouch < ActiveRecord::Observer
  observe 'ticket'

  def after_create(record)
    ref_object_touch(record)
  end
  def after_update(record)
    ref_object_touch(record)
  end
  def after_destroy(record)
    ref_object_touch(record)
  end

  def ref_object_touch(record)

    # return if we run import mode
    return if Setting.get('import_mode')
    if record.customer
      record.customer.touch
    end
    if record.organization
      record.organization.touch
    end
  end
end
{'fraction_non_alphanumeric': 0.07828655834564253, 'fraction_numerical': 0.011816838995568686, 'mean_word_length': 3.7711267605633805, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2131861', 'n_tokens_mistral': 444, 'n_tokens_neox': 413, 'n_words': 105}