import Ember from 'ember';

export default Ember.Object.extend({

  name: '',
  userList: null,
  messages: null,
  connected: false,
  sockethubChannelId: null,
  topic: null,

  slug: function() {
    // This could be based on server type in the future. E.g. IRC would be
    // server URL, while Campfire would be another id.
    return this.get('name').replace(/#/g,'');
  }.property('name'),

  formattedTopic: function() {
    if (this.get('topic') !== null) {
      let topic = linkifyStr(this.get('topic'), {
        defaultProtocol: 'https',
        linkAttributes: { rel: 'nofollow' }
      });
      return new Ember.String.htmlSafe(topic);
    } else {
      return "";
    }
  }.property('message'),

});

@@ -675,10 +675,10 @@
 urn 
-%22%22
+''
 ;%0A  
@@ -699,18 +699,15 @@
 ty('
-message
+topic
 ')
-,
 %0A%0A%7D)

Set correct dependent property for formattedTopic