diff options
author | William Pitcock <nenolod@dereferenced.org> | 2019-05-17 20:42:51 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2019-05-17 22:13:24 +0000 |
commit | dc081595385084fe6b382e4b38c17cb51cf0a611 (patch) | |
tree | f17053b71f9ce5a597c5baf6b2ae9538c5e6d716 /test | |
parent | 0da1233e8e093ff7c69994f9e81d58611be60507 (diff) | |
download | pleroma-dc081595385084fe6b382e4b38c17cb51cf0a611.tar.gz pleroma-dc081595385084fe6b382e4b38c17cb51cf0a611.zip |
also suppress link previews from posts marked #nsfw
Diffstat (limited to 'test')
-rw-r--r-- | test/web/rich_media/helpers_test.exs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/web/rich_media/helpers_test.exs b/test/web/rich_media/helpers_test.exs index 6e23392ca..53b0596f5 100644 --- a/test/web/rich_media/helpers_test.exs +++ b/test/web/rich_media/helpers_test.exs @@ -67,7 +67,26 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do {:ok, activity} = CommonAPI.post(user, %{ "status" => "http://example.com/ogp", - "spoiler_text" => "." + "sensitive" => true + }) + + %Object{} = object = Object.normalize(activity) + + assert object.data["sensitive"] + + Pleroma.Config.put([:rich_media, :enabled], true) + + assert %{} = Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity) + + Pleroma.Config.put([:rich_media, :enabled], false) + end + + test "refuses to crawl URLs from posts tagged NSFW" do + user = insert(:user) + + {:ok, activity} = + CommonAPI.post(user, %{ + "status" => "http://example.com/ogp #nsfw" }) %Object{} = object = Object.normalize(activity) |