<commit_before>class window.ChannelsController extends Backbone.Marionette.Controller

  loadTopic: (slug_title, callback) ->
    topic = new Topic {slug_title}
    topic.fetch success: (model) -> callback(model)
    topic

  showSidebarForTopic: (topic) ->
    FactlinkApp.leftBottomRegion.close()
    @showUserProfile currentUser
    window.Channels.setUsernameAndRefreshIfNeeded currentUser.get('username') # TODO: check if this can be removed
    FactlinkApp.Sidebar.showForTopicsAndActivateCorrectItem(topic)

  showTopicFacts: (slug_title) ->
    FactlinkApp.mainRegion.close()

    @loadTopic slug_title, (topic) =>
      @showSidebarForTopic(topic)
      FactlinkApp.mainRegion.show new TopicView model: topic


  loadChannel: (username, channel_id, callback) ->
    channel = Channels.get(channel_id)

    if (channel)
      callback(channel)<commit_msg>Don't show sidebar menu when not signed in<commit_after>class window.ChannelsController extends Backbone.Marionette.Controller

  loadTopic: (slug_title, callback) ->
    topic = new Topic {slug_title}
    topic.fetch success: (model) -> callback(model)
    topic

  showSidebarForTopic: (topic) ->
    FactlinkApp.leftBottomRegion.close()

    if Factlink.Global.signed_in
      @showUserProfile currentUser
      window.Channels.setUsernameAndRefreshIfNeeded currentUser.get('username') # TODO: check if this can be removed
      FactlinkApp.Sidebar.showForTopicsAndActivateCorrectItem(topic)

  showTopicFacts: (slug_title) ->
    FactlinkApp.mainRegion.close()

    @loadTopic slug_title, (topic) =>
      @showSidebarForTopic(topic)
      FactlinkApp.mainRegion.show new TopicView model: topic


  loadChannel: (username, channel_id, callback) ->
    channel = Channels.get(channel_id)

    if (channel)
      callback(channel)
{'fraction_non_alphanumeric': 0.09303621169916435, 'fraction_numerical': 0.0, 'mean_word_length': 4.297935103244837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1689448', 'n_tokens_mistral': 558, 'n_tokens_neox': 532, 'n_words': 112}