<commit_before>/**
  The topic map underneath the first post of a topic.

  @class DiscourseTopicMapComponent
  @extends Ember.Component
  @namespace Discourse
  @module Discourse
**/

var LINKS_SHOWN = 5;

Discourse.DiscourseTopicMapComponent = Ember.Component.extend({
  mapCollapsed: true,
  templateName: 'components/discourse-topic-map',
  details: Em.computed.alias('topic.details'),
  allLinksShown: false,

  init: function() {
    this._super();

    // If the topic has a summary, expand the map by default
    this.set('mapCollapsed', !this.get('topic.has_summary'));
  },

  toggleMapClass: function() {
    return this.get('mapCollapsed') ? 'icon-chevron-down' : 'icon-chevron-up';
  }.property('mapCollapsed'),

  showAllLinksControls: function() {
    if (this.get('allLinksShown')) return false;
    if ((this.get('details.links.length') || 0) <= LINKS_SHOWN) return false;
    return true;
  }.property('allLinksShown', 'topic.details.links'),

  infoLinks: function() {
    if (Em.isNone('details.links')) return [];

    var allLinks = this.get('details.links');
    if (this.get('allLinksShown')) return allLinks;
    return allLinks.slice(0, LINKS_SHOWN);
  }.property('details.links', 'allLinksShown'),

  actions: {
    toggleMap: function() {
      this.toggleProperty('mapCollapsed');
    },

    showAllLinks: function() {
      this.set('allLinksShown', true);
    }
  }
});
<commit_msg>FIX: Topic map expansion broken without links.<commit_after>/**
  The topic map underneath the first post of a topic.

  @class DiscourseTopicMapComponent
  @extends Ember.Component
  @namespace Discourse
  @module Discourse
**/

var LINKS_SHOWN = 5;

Discourse.DiscourseTopicMapComponent = Ember.Component.extend({
  mapCollapsed: true,
  templateName: 'components/discourse-topic-map',
  details: Em.computed.alias('topic.details'),
  allLinksShown: false,

  init: function() {
    this._super();

    // If the topic has a summary, expand the map by default
    this.set('mapCollapsed', !this.get('topic.has_summary'));
  },

  toggleMapClass: function() {
    return this.get('mapCollapsed') ? 'icon-chevron-down' : 'icon-chevron-up';
  }.property('mapCollapsed'),

  showAllLinksControls: function() {
    if (this.get('allLinksShown')) return false;
    if ((this.get('details.links.length') || 0) <= LINKS_SHOWN) return false;
    return true;
  }.property('allLinksShown', 'topic.details.links'),

  infoLinks: function() {
    var allLinks = this.get('details.links');
    if (Em.isNone(allLinks)) return [];

    if (this.get('allLinksShown')) return allLinks;
    return allLinks.slice(0, LINKS_SHOWN);

  }.property('details.links', 'allLinksShown'),

  actions: {
    toggleMap: function() {
      this.toggleProperty('mapCollapsed');
    },

    showAllLinks: function() {
      this.set('allLinksShown', true);
    }
  }
});

{'fraction_non_alphanumeric': 0.15026269702276707, 'fraction_numerical': 0.0021015761821366026, 'mean_word_length': 4.010526315789473, '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': '7059523', 'n_tokens_mistral': 947, 'n_tokens_neox': 903, 'n_words': 198}