<commit_before>module Channels
  class AutoCompletedChannel < Mustache::Railstache
    def title
      h self[:topic].title
    end
  end
end<commit_msg>Check if the topic is an existing channel<commit_after>module Channels
  class AutoCompletedChannel < Mustache::Railstache
    def title
      h self[:topic].title
    end

    def user_channel
      ch = ::Channel.find(created_by_id: current_graph_user.id, slug_title: title.to_url).first

      if ch
        Channel.for(:channel => ch, view: self).to_hash
      else
        false
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0726950354609929, 'fraction_numerical': 0.0, 'mean_word_length': 2.896551724137931, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '4257905', 'n_tokens_mistral': 174, 'n_tokens_neox': 168, 'n_words': 47}