parent
fe3d8814c4
commit
6c71d9f257
3 changed files with 16 additions and 10 deletions
|
|
@ -55,6 +55,7 @@
|
|||
* 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)
|
||||
* 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
|
||||
* Hide post title of limited post in comment notification email [#5843](https://github.com/diaspora/diaspora/pull/5843)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ module Diaspora
|
|||
end
|
||||
|
||||
def normalize message
|
||||
message.delete("\u202a-\u202e\u200b-\u200f")
|
||||
message.gsub(/[\u202a\u202b]#[\u200e\u200f\u202d\u202e](\S+)\u202c/u, "#\\1")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Diaspora::MessageRenderer do
|
||||
def message text, opts={}
|
||||
MESSAGE_NORMALIZTIONS = {
|
||||
"\u202a#\u200eUSA\u202c" => "#USA",
|
||||
"ള്" => "ള്"
|
||||
}
|
||||
|
||||
def message(text, opts={})
|
||||
Diaspora::MessageRenderer.new(text, opts)
|
||||
end
|
||||
|
||||
|
|
@ -122,10 +127,10 @@ describe Diaspora::MessageRenderer do
|
|||
).to include 'href="http://joindiaspora.com/"'
|
||||
end
|
||||
|
||||
it 'normalizes' do
|
||||
expect(
|
||||
message("\u202a#\u200eUSA\u202c").markdownified
|
||||
).to eq %(<p><a class="tag" href="/tags/USA">#USA</a></p>\n)
|
||||
it "normalizes" do
|
||||
MESSAGE_NORMALIZTIONS.each do |input, output|
|
||||
expect(message(input).plain_text_for_json).to eq output
|
||||
end
|
||||
end
|
||||
|
||||
context 'when formatting status messages' do
|
||||
|
|
@ -218,10 +223,10 @@ describe Diaspora::MessageRenderer do
|
|||
end
|
||||
|
||||
describe "#plain_text_for_json" do
|
||||
it 'normalizes' do
|
||||
expect(
|
||||
message("\u202a#\u200eUSA\u202c").plain_text_for_json
|
||||
).to eq '#USA'
|
||||
it "normalizes" do
|
||||
MESSAGE_NORMALIZTIONS.each do |input, output|
|
||||
expect(message(input).plain_text_for_json).to eq output
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue