projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Notifications: Make notifications save their type.
[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 84eeea0bc43388fdb467145ba29be4e8e3bdc532..28727d619ea3d9180ecb811cf4ca6f0db2186103 100644
(file)
--- a/
lib/pleroma/web/activity_pub/activity_pub_controller.ex
+++ b/
lib/pleroma/web/activity_pub/activity_pub_controller.ex
@@
-21,6
+21,7
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
alias Pleroma.Web.ActivityPub.UserView
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.Visibility
alias Pleroma.Web.ActivityPub.UserView
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.ActivityPub.Visibility
+ alias Pleroma.Web.Endpoint
alias Pleroma.Web.FederatingPlug
alias Pleroma.Web.Federator
alias Pleroma.Web.FederatingPlug
alias Pleroma.Web.Federator
@@
-34,7
+35,7
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
plug(
EnsureAuthenticatedPlug,
plug(
EnsureAuthenticatedPlug,
- [unless_func: &FederatingPlug.federating?/
0
] when action not in @federating_only_actions
+ [unless_func: &FederatingPlug.federating?/
1
] when action not in @federating_only_actions
)
# Note: :following and :followers must be served even without authentication (as via :api)
)
# Note: :following and :followers must be served even without authentication (as via :api)
@@
-75,8
+76,8
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
end
end
end
end
- def object(conn,
%{"uuid" => uuid}
) do
- with ap_id <-
o_status_url(conn, :object, uuid)
,
+ def object(conn,
_
) do
+ with ap_id <-
Endpoint.url() <> conn.request_path
,
%Object{} = object <- Object.get_cached_by_ap_id(ap_id),
{_, true} <- {:public?, Visibility.is_public?(object)} do
conn
%Object{} = object <- Object.get_cached_by_ap_id(ap_id),
{_, true} <- {:public?, Visibility.is_public?(object)} do
conn
@@
-101,8
+102,8
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
conn
end
conn
end
- def activity(conn,
%{"uuid" => uuid}
) do
- with ap_id <-
o_status_url(conn, :activity, uuid)
,
+ def activity(conn,
_params
) do
+ with ap_id <-
Endpoint.url() <> conn.request_path
,
%Activity{} = activity <- Activity.normalize(ap_id),
{_, true} <- {:public?, Visibility.is_public?(activity)} do
conn
%Activity{} = activity <- Activity.normalize(ap_id),
{_, true} <- {:public?, Visibility.is_public?(activity)} do
conn
@@
-396,7
+397,10
@@
defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|> json(err)
end
|> json(err)
end
- defp handle_user_activity(%User{} = user, %{"type" => "Create"} = params) do
+ defp handle_user_activity(
+ %User{} = user,
+ %{"type" => "Create", "object" => %{"type" => "Note"}} = params
+ ) do
object =
params["object"]
|> Map.merge(Map.take(params, ["to", "cc"]))
object =
params["object"]
|> Map.merge(Map.take(params, ["to", "cc"]))