summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-06-09 13:55:32 +0300
committerrinpatch <rinpatch@sdf.org>2019-06-09 13:55:32 +0300
commit3ecfe2a6d4874cc6f7873c3d8c76f25d6b83829a (patch)
tree50fe70940473a5cd40093c1c53650135e24ab651
parentbf391569cf83c3dec75fe1a6870ae0b9f228400b (diff)
parentb9544d565d42cd0705f6f583b328d1034ae8ae97 (diff)
downloadpleroma-3ecfe2a6d4874cc6f7873c3d8c76f25d6b83829a.tar.gz
pleroma-3ecfe2a6d4874cc6f7873c3d8c76f25d6b83829a.zip
Merge branch 'develop' into feature/releases
-rw-r--r--CHANGELOG.md1
-rw-r--r--config/prod.exs2
-rw-r--r--lib/pleroma/emoji.ex4
-rw-r--r--lib/pleroma/web/activity_pub/transmogrifier.ex2
-rw-r--r--test/web/activity_pub/transmogrifier_test.exs16
5 files changed, 22 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf2232b09..510ad7ff5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -64,6 +64,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Federation: Expand the audience of delete activities to all recipients of the deleted object
- Federation: Removed `inReplyToStatusId` from objects
- Configuration: Dedupe enabled by default
+- Configuration: Default log level in `prod` environment is now set to `warn`
- Configuration: Added `extra_cookie_attrs` for setting non-standard cookie attributes. Defaults to ["SameSite=Lax"] so that remote follows work.
- Timelines: Messages involving people you have blocked will be excluded from the timeline in all cases instead of just repeats.
- Admin API: Move the user related API to `api/pleroma/admin/users`
diff --git a/config/prod.exs b/config/prod.exs
index adc1c4bb7..bf1a97de0 100644
--- a/config/prod.exs
+++ b/config/prod.exs
@@ -20,7 +20,7 @@ config :pleroma, Pleroma.Web.Endpoint,
config :phoenix, serve_endpoints: true
# Do not print debug messages in production
-config :logger, level: :info
+config :logger, level: :warn
# ## SSL Support
#
diff --git a/lib/pleroma/emoji.ex b/lib/pleroma/emoji.ex
index de7fcc1ce..b77b26f7f 100644
--- a/lib/pleroma/emoji.ex
+++ b/lib/pleroma/emoji.ex
@@ -98,7 +98,9 @@ defmodule Pleroma.Emoji do
Logger.error("Could not access the custom emoji directory #{emoji_dir_path}: #{e}")
{:ok, results} ->
- grouped = Enum.group_by(results, &File.dir?/1)
+ grouped =
+ Enum.group_by(results, fn file -> File.dir?(Path.join(emoji_dir_path, file)) end)
+
packs = grouped[true] || []
files = grouped[false] || []
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index ff031a16e..3bb8b40b5 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -339,7 +339,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
def fix_type(%{"inReplyTo" => reply_id} = object) when is_binary(reply_id) do
reply = Object.normalize(reply_id)
- if reply.data["type"] == "Question" and object["name"] do
+ if reply && (reply.data["type"] == "Question" and object["name"]) do
Map.put(object, "type", "Answer")
else
object
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs
index 28971ae45..cc1781403 100644
--- a/test/web/activity_pub/transmogrifier_test.exs
+++ b/test/web/activity_pub/transmogrifier_test.exs
@@ -60,6 +60,22 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
assert returned_object.data["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
end
+ test "it does not crash if the object in inReplyTo can't be fetched" do
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Poison.decode!()
+
+ object =
+ data["object"]
+ |> Map.put("inReplyTo", "https://404.site/whatever")
+
+ data =
+ data
+ |> Map.put("object", object)
+
+ {:ok, _returned_activity} = Transmogrifier.handle_incoming(data)
+ end
+
test "it works for incoming notices" do
data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()