Return a jquery object from the mediamessage handler
authorNick Fisher <spadgos@gmail.com>
Fri, 19 Dec 2014 01:03:57 +0000 (02:03 +0100)
committerNick Fisher <spadgos@gmail.com>
Fri, 19 Dec 2014 01:04:28 +0000 (02:04 +0100)
Avoids 'reaching' outside where this method should be reaching.

client/src/views/mediamessage.js

index f86d99a9c3168e6d54ddefdca96b7bdcca8eeb2a..6351eb7cad675de1eb7b1c09a4b8a083b1a2472e 100644 (file)
@@ -164,7 +164,7 @@ _kiwi.view.MediaMessage = Backbone.View.extend({
 
         soundcloud: function () {
             var url = this.$el.data('url'),
-                $content = this.$content.find('.content');
+                $content = $('<div></div>').text(_kiwi.global.i18n.translate('client_models_applet_loading').fetch());
 
             $.getJSON('http://soundcloud.com/oembed', { url: url })
                 .then(function (data) {
@@ -172,10 +172,10 @@ _kiwi.view.MediaMessage = Backbone.View.extend({
                         $(data.html).attr('height', data.height - 100)
                     );
                 }, function () {
-                    $content.html(_kiwi.global.i18n.translate('client_views_mediamessage_notfound').fetch());
+                    $content.text(_kiwi.global.i18n.translate('client_views_mediamessage_notfound').fetch());
                 });
 
-            return _kiwi.global.i18n.translate('client_models_applet_loading').fetch();
+            return $content;
         },
 
         custom: function() {