Do not strip "markdown" in links when posting to services, fix #3765

This commit is contained in:
Jonne Haß 2012-11-26 14:16:43 +01:00
parent 995775955e
commit bf698f3882
4 changed files with 11 additions and 5 deletions

View file

@ -11,6 +11,7 @@
* Force Typhoeus/cURL to use the CA bundle we query via the config. Also add a setting for extra verbose output.
* Validate input on sending invitations, validate email format, send correct ones. [#3748](https://github.com/diaspora/diaspora/pull/3748), [#3271](https://github.com/diaspora/diaspora/issues/3271)
* moved Aspects JS initializer to the correct place so aspect selection / deselection works again [#3737] (https://github.com/diaspora/diaspora/pull/3737)
* Do not strip "markdown" in links when posting to services [#3765](https://github.com/diaspora/diaspora/issues/3765)
# 0.0.2.0

View file

@ -48,7 +48,7 @@ module MarkdownifyHelper
end
def strip_markdown(text)
renderer = Redcarpet::Markdown.new(Redcarpet::Render::StripDown)
renderer = Redcarpet::Markdown.new(Redcarpet::Render::StripDown, :autolink => true)
renderer.render(text)
end

View file

@ -5,7 +5,6 @@
require 'spec_helper'
describe MarkdownifyHelper do
describe "#markdownify" do
describe "not doing something dumb" do
it "strips out script tags" do
@ -86,4 +85,11 @@ describe MarkdownifyHelper do
end
end
end
describe "#strip_markdown" do
it 'does not remove markdown in links' do
message = "some text and here comes http://exampe.org/foo_bar_baz a link"
strip_markdown(message).should match message
end
end
end

View file

@ -23,17 +23,16 @@ describe Service do
end
it 'removes text formatting markdown from post text' do
service = Service.new()
service = Service.new
message = "Text with some **bolded** and _italic_ parts."
post = stub(:text => message)
service.public_message(post, 200, '', false).should match "Text with some bolded and italic parts."
end
it 'keeps markdown in post text when specified' do
service = Service.new()
service = Service.new
message = "Text with some **bolded** and _italic_ parts."
post = stub(:text => message)
service.public_message(post, 200, '', false, true).should match 'Text with some \*\*bolded\*\* and _italic_ parts.'
end
end