diff options
author | lambda <pleromagit@rogerbraun.net> | 2018-03-27 06:27:12 +0000 |
---|---|---|
committer | lambda <pleromagit@rogerbraun.net> | 2018-03-27 06:27:12 +0000 |
commit | 2e683b10d54030c045c570b6ce44b9b3291ae6e1 (patch) | |
tree | a9bdbf09acb9c631820851a0497e714f0ec42c68 | |
parent | bd4926288e6b5d8d3e4439d83e30fa0211045d0b (diff) | |
parent | 9556c8f6e720a1b63df16d7165a40936b52fc0b4 (diff) | |
download | pleroma-2e683b10d54030c045c570b6ce44b9b3291ae6e1.tar.gz |
Merge branch 'fix/hashtag-consistency' into 'develop'
Include the '#' symbol into the hashtag link itself
See merge request pleroma/pleroma!85
-rw-r--r-- | lib/pleroma/formatter.ex | 2 | ||||
-rw-r--r-- | test/formatter_test.exs | 2 | ||||
-rw-r--r-- | test/web/twitter_api/twitter_api_test.exs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index 2d3487f6a..4afc73bf4 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -189,7 +189,7 @@ defmodule Pleroma.Formatter do end) subs = subs ++ Enum.map(tags, fn ({_, tag, uuid}) -> - url = "#<a href='#{Pleroma.Web.base_url}/tag/#{tag}' rel='tag'>#{tag}</a>" + url = "<a href='#{Pleroma.Web.base_url}/tag/#{tag}' rel='tag'>##{tag}</a>" {uuid, url} end) diff --git a/test/formatter_test.exs b/test/formatter_test.exs index 0e915d8d5..9ec2cc9f2 100644 --- a/test/formatter_test.exs +++ b/test/formatter_test.exs @@ -7,7 +7,7 @@ defmodule Pleroma.FormatterTest do describe ".add_hashtag_links" do test "turns hashtags into links" do text = "I love #cofe and #2hu" - expected_text = "I love #<a href='http://localhost:4001/tag/cofe' rel='tag'>cofe</a> and #<a href='http://localhost:4001/tag/2hu' rel='tag'>2hu</a>" + expected_text = "I love <a href='http://localhost:4001/tag/cofe' rel='tag'>#cofe</a> and <a href='http://localhost:4001/tag/2hu' rel='tag'>#2hu</a>" tags = Formatter.parse_tags(text) assert expected_text == Formatter.add_hashtag_links({[], text}, tags) |> Formatter.finalize diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs index 7d578a751..715a746ef 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/web/twitter_api/twitter_api_test.exs @@ -34,7 +34,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do { :ok, activity = %Activity{} } = TwitterAPI.create_status(user, input) - expected_text = "Hello again, <span><a href='shp'>@<span>shp</span></a></span>.<script></script><br>This is on another :moominmamma: line. #<a href='http://localhost:4001/tag/2hu' rel='tag'>2hu</a> #<a href='http://localhost:4001/tag/epic' rel='tag'>epic</a> #<a href='http://localhost:4001/tag/phantasmagoric' rel='tag'>phantasmagoric</a><br><a href=\"http://example.org/image.jpg\" class='attachment'>image.jpg</a>" + expected_text = "Hello again, <span><a href='shp'>@<span>shp</span></a></span>.<script></script><br>This is on another :moominmamma: line. <a href='http://localhost:4001/tag/2hu' rel='tag'>#2hu</a> <a href='http://localhost:4001/tag/epic' rel='tag'>#epic</a> <a href='http://localhost:4001/tag/phantasmagoric' rel='tag'>#phantasmagoric</a><br><a href=\"http://example.org/image.jpg\" class='attachment'>image.jpg</a>" assert get_in(activity.data, ["object", "content"]) == expected_text assert get_in(activity.data, ["object", "type"]) == "Note" assert get_in(activity.data, ["object", "actor"]) == user.ap_id |