Merge branch 'revert/rich-media-censorship' into 'develop'
#2192 Revert Rich Media censorship for sensitive statuses See merge request pleroma/pleroma!3044
This commit is contained in:
commit
f9ece1a7f6
3 changed files with 1 additions and 36 deletions
|
@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- **Breaking:** Pleroma Admin API: emoji packs and files routes changed.
|
- **Breaking:** Pleroma Admin API: emoji packs and files routes changed.
|
||||||
|
- **Breaking:** Sensitive/NSFW statuses no longer disable link previews.
|
||||||
- Search: Users are now findable by their urls.
|
- Search: Users are now findable by their urls.
|
||||||
- Renamed `:await_up_timeout` in `:connections_pool` namespace to `:connect_timeout`, old name is deprecated.
|
- Renamed `:await_up_timeout` in `:connections_pool` namespace to `:connect_timeout`, old name is deprecated.
|
||||||
- Renamed `:timeout` in `pools` namespace to `:recv_timeout`, old name is deprecated.
|
- Renamed `:timeout` in `pools` namespace to `:recv_timeout`, old name is deprecated.
|
||||||
|
|
|
@ -57,7 +57,6 @@ defp get_tld(host) do
|
||||||
|
|
||||||
def fetch_data_for_object(object) do
|
def fetch_data_for_object(object) do
|
||||||
with true <- Config.get([:rich_media, :enabled]),
|
with true <- Config.get([:rich_media, :enabled]),
|
||||||
false <- object.data["sensitive"] || false,
|
|
||||||
{:ok, page_url} <-
|
{:ok, page_url} <-
|
||||||
HTML.extract_first_external_url_from_object(object),
|
HTML.extract_first_external_url_from_object(object),
|
||||||
:ok <- validate_page_url(page_url),
|
:ok <- validate_page_url(page_url),
|
||||||
|
|
|
@ -64,41 +64,6 @@ test "crawls valid, complete URLs" do
|
||||||
Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
|
Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "refuses to crawl URLs from posts marked sensitive" do
|
|
||||||
user = insert(:user)
|
|
||||||
|
|
||||||
{:ok, activity} =
|
|
||||||
CommonAPI.post(user, %{
|
|
||||||
status: "http://example.com/ogp",
|
|
||||||
sensitive: true
|
|
||||||
})
|
|
||||||
|
|
||||||
%Object{} = object = Object.normalize(activity)
|
|
||||||
|
|
||||||
assert object.data["sensitive"]
|
|
||||||
|
|
||||||
Config.put([:rich_media, :enabled], true)
|
|
||||||
|
|
||||||
assert %{} = Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
|
|
||||||
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)
|
|
||||||
|
|
||||||
assert object.data["sensitive"]
|
|
||||||
|
|
||||||
Config.put([:rich_media, :enabled], true)
|
|
||||||
|
|
||||||
assert %{} = Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "refuses to crawl URLs of private network from posts" do
|
test "refuses to crawl URLs of private network from posts" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue