Fix mention syntax backport for two immediately consecutive mentions
Fixes #7695. closes #7777
This commit is contained in:
parent
01ae004518
commit
4aec9fbb42
3 changed files with 9 additions and 1 deletions
|
|
@ -7,6 +7,7 @@
|
|||
* Prefill conversation form on contacts page only with mutual contacts [#7744](https://github.com/diaspora/diaspora/pull/7744)
|
||||
* Fix profiles sometimes not loading properly in background tabs [#7740](https://github.com/diaspora/diaspora/pull/7740)
|
||||
* Show error message when creating posts with invalid aspects [#7742](https://github.com/diaspora/diaspora/pull/7742)
|
||||
* Fix mention syntax backport for two immediately consecutive mentions [#7777](https://github.com/diaspora/diaspora/pull/7777)
|
||||
|
||||
## Features
|
||||
* Make public stream accessible for logged out users [#7775](https://github.com/diaspora/diaspora/pull/7775)
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ module Diaspora::Mentionable
|
|||
end
|
||||
|
||||
# Regex to find mentions with new syntax, only used for backporting to old syntax
|
||||
NEW_SYNTAX_REGEX = /@\{[^ ]+\}/
|
||||
NEW_SYNTAX_REGEX = /@\{[^\} ]+\}/
|
||||
|
||||
# replaces new syntax with old syntax, to be compatible with old pods
|
||||
# @deprecated remove when most of the posts can handle the new syntax
|
||||
|
|
|
|||
|
|
@ -217,6 +217,13 @@ STR
|
|||
expect(Diaspora::Mentionable.backport_mention_syntax(text)).to eq(expected_text)
|
||||
end
|
||||
|
||||
it "replaces the new syntax with the old syntax for immediately consecutive mentions" do
|
||||
text = "mention @{#{people[0].diaspora_handle}}@{#{people[1].diaspora_handle}} text"
|
||||
expected_text = "mention @{#{people[0].name}; #{people[0].diaspora_handle}}" \
|
||||
"@{#{people[1].name}; #{people[1].diaspora_handle}} text"
|
||||
expect(Diaspora::Mentionable.backport_mention_syntax(text)).to eq(expected_text)
|
||||
end
|
||||
|
||||
it "removes curly braces from name of the mentioned person when adding it" do
|
||||
profile = FactoryGirl.build(:profile, first_name: "{Alice}", last_name: "(Smith) [123]")
|
||||
person = FactoryGirl.create(:person, profile: profile)
|
||||
|
|
|
|||
Loading…
Reference in a new issue