Merge branch 'stable' into develop

This commit is contained in:
Jonne Haß 2015-06-06 15:23:44 +02:00
commit 7bfa0f857c
3 changed files with 16 additions and 10 deletions

View file

@ -87,6 +87,7 @@ Ruby 2.0 is no longer officially supported.
* Fix the logo in emails [#6013](https://github.com/diaspora/diaspora/pull/6013) * Fix the logo in emails [#6013](https://github.com/diaspora/diaspora/pull/6013)
* Disable autocorrect for username on mobile sign in [#6028](https://github.com/diaspora/diaspora/pull/6028) * Disable autocorrect for username on mobile sign in [#6028](https://github.com/diaspora/diaspora/pull/6028)
* Fix broken default avatars in the database [#6014](https://github.com/diaspora/diaspora/pull/6014) * Fix broken default avatars in the database [#6014](https://github.com/diaspora/diaspora/pull/6014)
* Only strip text direction codepoints around hashtags [#6067](https://github.com/diaspora/diaspora/issues/6067)
## Features ## Features
* Hide post title of limited post in comment notification email [#5843](https://github.com/diaspora/diaspora/pull/5843) * Hide post title of limited post in comment notification email [#5843](https://github.com/diaspora/diaspora/pull/5843)

View file

@ -16,7 +16,7 @@ module Diaspora
end end
def normalize message def normalize message
message.delete("\u202a-\u202e\u200b-\u200f") message.gsub(/[\u202a\u202b]#[\u200e\u200f\u202d\u202e](\S+)\u202c/u, "#\\1")
end end
end end

View file

@ -1,7 +1,12 @@
require 'spec_helper' require 'spec_helper'
describe Diaspora::MessageRenderer do describe Diaspora::MessageRenderer do
def message text, opts={} MESSAGE_NORMALIZTIONS = {
"\u202a#\u200eUSA\u202c" => "#USA",
"ള്‍" => "ള്‍"
}
def message(text, opts={})
Diaspora::MessageRenderer.new(text, opts) Diaspora::MessageRenderer.new(text, opts)
end end
@ -122,10 +127,10 @@ describe Diaspora::MessageRenderer do
).to include 'href="http://joindiaspora.com/"' ).to include 'href="http://joindiaspora.com/"'
end end
it 'normalizes' do it "normalizes" do
expect( MESSAGE_NORMALIZTIONS.each do |input, output|
message("\u202a#\u200eUSA\u202c").markdownified expect(message(input).plain_text_for_json).to eq output
).to eq %(<p><a class="tag" href="/tags/USA">#USA</a></p>\n) end
end end
context 'when formatting status messages' do context 'when formatting status messages' do
@ -218,10 +223,10 @@ describe Diaspora::MessageRenderer do
end end
describe "#plain_text_for_json" do describe "#plain_text_for_json" do
it 'normalizes' do it "normalizes" do
expect( MESSAGE_NORMALIZTIONS.each do |input, output|
message("\u202a#\u200eUSA\u202c").plain_text_for_json expect(message(input).plain_text_for_json).to eq output
).to eq '#USA' end
end end
end end
end end