Add class=attachment to attachment links.

This commit is contained in:
Roger Braun 2017-05-08 20:12:36 +02:00
parent 8f9c43343e
commit 1418d72749
2 changed files with 2 additions and 2 deletions

View file

@ -35,7 +35,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
def add_attachments(text, attachments) do def add_attachments(text, attachments) do
attachment_text = Enum.map(attachments, fn attachment_text = Enum.map(attachments, fn
(%{"url" => [%{"href" => href} | _]}) -> (%{"url" => [%{"href" => href} | _]}) ->
"<a href='#{href}'>#{href}</a>" "<a href='#{href}' class='attachment'>#{href}</a>"
_ -> "" _ -> ""
end) end)
Enum.join([text | attachment_text], "<br>") Enum.join([text | attachment_text], "<br>")

View file

@ -33,7 +33,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do
{ :ok, activity = %Activity{} } = TwitterAPI.create_status(user, input) { :ok, activity = %Activity{} } = TwitterAPI.create_status(user, input)
assert get_in(activity.data, ["object", "content"]) == "Hello again, <a href='shp'>@shp</a>.<br>This is on another line.<br><a href='http://example.org/image.jpg'>http://example.org/image.jpg</a>" assert get_in(activity.data, ["object", "content"]) == "Hello again, <a href='shp'>@shp</a>.<br>This is on another line.<br><a href='http://example.org/image.jpg' class='attachment'>http://example.org/image.jpg</a>"
assert get_in(activity.data, ["object", "type"]) == "Note" assert get_in(activity.data, ["object", "type"]) == "Note"
assert get_in(activity.data, ["object", "actor"]) == user.ap_id assert get_in(activity.data, ["object", "actor"]) == user.ap_id
assert get_in(activity.data, ["actor"]) == user.ap_id assert get_in(activity.data, ["actor"]) == user.ap_id