projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Apply suggestion to lib/pleroma/web/activity_pub/activity_pub_controller.ex
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
activity_pub_controller.ex
diff --git
a/lib/pleroma/web/activity_pub/activity_pub_controller.ex
b/lib/pleroma/web/activity_pub/activity_pub_controller.ex
index 009260d3f2b43d46183f59a56df8944b0d0656eb..01b34fb1d475df01dc3d2ce5f87f762e359360e8 100644
(file)
--- a/
lib/pleroma/web/activity_pub/activity_pub_controller.ex
+++ b/
lib/pleroma/web/activity_pub/activity_pub_controller.ex
@@
-26,10
+26,7
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
plug(
Pleroma.Plugs.Cache,
plug(
Pleroma.Plugs.Cache,
- [
- query_params: false,
- tracking_fun: &Pleroma.Web.ActivityPub.ActivityPubController.track_object_fetch/2
- ]
+ [query_params: false, tracking_fun: &__MODULE__.track_object_fetch/2]
when action in [:activity, :object]
)
when action in [:activity, :object]
)
@@
-74,10
+71,11
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
end
end
end
end
+ def track_object_fetch(conn, nil), do: conn
+
def track_object_fetch(conn, object_id) do
def track_object_fetch(conn, object_id) do
- case conn.assigns[:user] do
- %User{id: user_id} -> Delivery.create(object_id, user_id)
- _ -> nil
+ with %{assigns: %{user: %User{id: user_id}}} <- conn do
+ Delivery.create(object_id, user_id)
end
conn
end
conn
@@
-134,7
+132,7
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
assign(conn, :tracking_fun_data, object_id)
end
assign(conn, :tracking_fun_data, object_id)
end
- defp maybe_set_tracking_data(conn, _activity), do:
assign(conn, :tracking_fun_data, nil)
+ defp maybe_set_tracking_data(conn, _activity), do:
conn
defp set_cache_ttl_for(conn, %Activity{object: object}) do
set_cache_ttl_for(conn, object)
defp set_cache_ttl_for(conn, %Activity{object: object}) do
set_cache_ttl_for(conn, object)