Skip to content
Snippets Groups Projects
Commit 035db983 authored by archi's avatar archi
Browse files

Added HTML links to posts

parent 482b2f5f
No related branches found
No related tags found
No related merge requests found
......@@ -10,4 +10,14 @@ module StatusMessagesHelper
return I18n.t('status_messages.helper.no_message_to_display')
end
end
def make_links(message)
# If there should be some kind of bb-style markup, email/diaspora highlighting, it could go here.
# next line is important due to XSS! (h is rail's make_html_safe-function)
message = h(message).html_safe
message.gsub!(/( |^)(www\.[^ ]+\.[^ ])/, '\1http://\2');
return message.gsub(/(http|ftp):\/\/([^ ]+)/, '<a target="_blank" href="\1://\2">\2</a>');
end
end
......@@ -23,7 +23,7 @@
= render "shared/reshare", :post => post, :current_user => current_user
= link_to t('.delete'), status_message_path(post), :confirm => t('.are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= post.message
= make_links(post.message)
.info
%span.time= link_to(how_long_ago(post), object_path(post))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment