logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: 1418d7274995ab62abedee0e55eae4fc3d041236
parent: 8f9c43343e239b3f3fd28651ca508f3ee1e4562c
Author: Roger Braun <roger@rogerbraun.net>
Date:   Mon,  8 May 2017 20:12:36 +0200

Add class=attachment to attachment links.

Diffstat:

Mlib/pleroma/web/twitter_api/twitter_api.ex2+-
Mtest/web/twitter_api/twitter_api_test.exs2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -35,7 +35,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do def add_attachments(text, attachments) do attachment_text = Enum.map(attachments, fn (%{"url" => [%{"href" => href} | _]}) -> - "<a href='#{href}'>#{href}</a>" + "<a href='#{href}' class='attachment'>#{href}</a>" _ -> "" end) Enum.join([text | attachment_text], "<br>") diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/web/twitter_api/twitter_api_test.exs @@ -33,7 +33,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do { :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", "actor"]) == user.ap_id assert get_in(activity.data, ["actor"]) == user.ap_id