diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f22780f1b..06ea22f3ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Fixed chat message layout for right-to-left languages +- Fixed parsing of messages containing multiple dots (elipsis) ## [0.9.22] - 2018-07-09 ### Added diff --git a/src/status_im/chat/views/message/message.cljs b/src/status_im/chat/views/message/message.cljs index 712f5206d6..136c36d4f2 100644 --- a/src/status_im/chat/views/message/message.cljs +++ b/src/status_im/chat/views/message/message.cljs @@ -167,7 +167,7 @@ (def regx-styled (re-pattern (string/join "|" (map first replacements)))) -(def regx-url #"(?i)(?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{1,4}/?)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'\".,<>?«»“”‘’]){0,}") +(def regx-url #"(?i)(?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9\-]+[.][a-z]{1,4}/?)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'\".,<>?«»“”‘’]){0,}") (defn- parse-str-regx [string regx matched-fn unmatched-fn] (if (string? string) diff --git a/test/cljs/status_im/test/chat/views/message.cljs b/test/cljs/status_im/test/chat/views/message.cljs index 66f61ca3a3..c7acade8e2 100644 --- a/test/cljs/status_im/test/chat/views/message.cljs +++ b/test/cljs/status_im/test/chat/views/message.cljs @@ -20,7 +20,13 @@ nil]) (message/parse-url "Status - https://github.com/status-im/status-react a Mobile Ethereum Operating System"))) (is (= (lazy-seq [{:text "Browse, chat and make payments securely on the decentralized web." :url? false} nil]) - (message/parse-url "Browse, chat and make payments securely on the decentralized web.")))) + (message/parse-url "Browse, chat and make payments securely on the decentralized web."))) + (is (= (lazy-seq [{:text "test...test..." :url? false} nil]) + (message/parse-url "test...test..."))) + (is (= (lazy-seq [{:text "test..test.." :url? false} nil]) + (message/parse-url "test..test.."))) + (is (= (lazy-seq [{:text "...test" :url? false} nil]) + (message/parse-url "...test")))) (deftest right-to-left-text? (is (not (message/right-to-left-text? "You are lucky today!")))