<commit_before># Display email link to promoter. Uses event email if there is one.
# Displays promoter email in promoter's name is blank.
# Displays just promoter's name if there are no email addresses.
module EventsHelper
  def link_to_event_email(event)
    email = event.email if event.email.present?
    email = event.promoter.email if !email && event.promoter && event.promoter.email.present?
    
    name = event.promoter.name if event.promoter && event.promoter.name.present?
    name = email if name.nil?

    if email.present?
      mail_to email, name
    else
      name
    end
  end

  def link_to_event_phone(event)
    return event.phone if event.phone.present?
    event.promoter.home_phone if event.promoter && event.promoter.home_phone.present?
  end

  # Only show link if flyer approved
  def public_link_to_flyer(event)
    return unless event
    if event.flyer_approved?
      link_to_flyer event
    else
      event.full_name
    end
  end

  # Show link even if not approved
  def link_to_flyer(event)
    # TODO Add more options and use throughout
    return unless event
    <commit_msg>Make public_link_to_flyer safe for non-events<commit_after># Display email link to promoter. Uses event email if there is one.
# Displays promoter email in promoter's name is blank.
# Displays just promoter's name if there are no email addresses.
module EventsHelper
  def link_to_event_email(event)
    email = event.email if event.email.present?
    email = event.promoter.email if !email && event.promoter && event.promoter.email.present?
    
    name = event.promoter.name if event.promoter && event.promoter.name.present?
    name = email if name.nil?

    if email.present?
      mail_to email, name
    else
      name
    end
  end

  def link_to_event_phone(event)
    return event.phone if event.phone.present?
    event.promoter.home_phone if event.promoter && event.promoter.home_phone.present?
  end

  # Only show link if flyer approved
  def public_link_to_flyer(event)
    return unless event && event.respond_to?(:flyer)
    if event.flyer_approved?
      link_to_flyer event
    else
      event.full_name
    end
  end

  # Show link even if not approved
  def link_to_flyer(event)
    # TODO Add more options and use throughout
    return unless event
    
{'fraction_non_alphanumeric': 0.06716092455298735, 'fraction_numerical': 0.0, 'mean_word_length': 3.163339382940109, 'pattern_counts': {'":': 0, '<': 3, '<?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': '490665', 'n_tokens_mistral': 717, 'n_tokens_neox': 690, 'n_words': 227}