Navigation Menu

Skip to content

Commit

Permalink
Fixes embed templates; escapes message content before passing it to p…
Browse files Browse the repository at this point in the history
…lugins

Signed-off-by: Akash Manohar J <akash@akash.im>
  • Loading branch information
HashNuke committed Apr 12, 2012
1 parent a5ef905 commit 1a50dcc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/backbone/plugins/image_embed.js.coffee
Expand Up @@ -4,8 +4,8 @@ class Kandan.Plugins.ImageEmbed

template: _.template '''
<div class="image-preview">
<a target="_blank" href="<%= image_url %>">
<img class="image-embed" src="<%= image_url %>" height="200" width="200" />
<a target="_blank" href="<%= imageUrl %>">
<img class="image-embed" src="<%= imageUrl %>" height="200" width="200" />
</a>
<div class="name"><%= subtitle %></div>
</div>
Expand Down
Expand Up @@ -6,8 +6,8 @@ class Kandan.Plugins.YouTubeEmbed

template: _.template '''
<div class="youtube-preview">
<a target="_blank" class="youtube-preview-link" href="<%= video_url %>">
<img class="youtube-preview-image" src="<%= thumb_url %>" />
<a target="_blank" class="youtube-preview-link" href="<%= videoUrl %>">
<img class="youtube-preview-image" src="<%= thumbUrl %>" />
</a>
<div class="name"><%= subtitle %></div>
</div>
Expand All @@ -27,7 +27,7 @@ class Kandan.Plugins.YouTubeEmbed
videoUrl = message.content.split(" ")[0]

videoId = message.content.match(@options.idRegex)[1]
thumbUrl = "http://img.youtube.com/vi/#{ video_id }/0.jpg"
thumbUrl = "http://img.youtube.com/vi/#{ videoId }/0.jpg"

subtitle = null
subtitle = "Youtube: #{comment}" if comment? and comment.length > 0
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/backbone/views/show_activity.js.coffee
Expand Up @@ -5,15 +5,15 @@ class Kandan.Views.ShowActivity extends Backbone.View

render: ()->
activity = @options.activity.toJSON()
console.log("Rendering activity:")
activity.content = _.escape(activity.content)
if activity.action != "message"
@compiledTemplate = JST['user_notification']({activity: activity})
else
modifiedMessage = Kandan.Modifiers.process(activity, @options.state)
if modifiedMessage != false
@compiledTemplate = modifiedMessage
else
@compiledTemplate = Kandan.Helpers.Activities.buildFromMessageTemplate $.extend(activity, {content: _.escape(activity.content)})
@compiledTemplate = Kandan.Helpers.Activities.buildFromMessageTemplate activity

$(@el).data("activity-id", activity.id)
$(@el).attr("id", "activity-#{activity.id}")
Expand Down

0 comments on commit 1a50dcc

Please sign in to comment.