projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SideEffects: Move streaming of chats to after the transaction.
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
utils.ex
diff --git
a/lib/pleroma/web/activity_pub/utils.ex
b/lib/pleroma/web/activity_pub/utils.ex
index f2375bcc4f7d1119cf923361b58fd920bfdab4f7..5fce0ba639616b0fb37f9c0bc2290daed8a2c659 100644
(file)
--- a/
lib/pleroma/web/activity_pub/utils.ex
+++ b/
lib/pleroma/web/activity_pub/utils.ex
@@
-7,6
+7,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
alias Ecto.UUID
alias Pleroma.Activity
alias Pleroma.Config
alias Ecto.UUID
alias Pleroma.Activity
alias Pleroma.Config
+ alias Pleroma.Maps
alias Pleroma.Notification
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.Notification
alias Pleroma.Object
alias Pleroma.Repo
@@
-307,7
+308,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
"cc" => cc,
"context" => object.data["context"]
}
"cc" => cc,
"context" => object.data["context"]
}
- |>
maybe_pu
t("id", activity_id)
+ |>
Maps.put_if_presen
t("id", activity_id)
end
def make_emoji_reaction_data(user, object, emoji, activity_id) do
end
def make_emoji_reaction_data(user, object, emoji, activity_id) do
@@
-477,7
+478,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
"object" => followed_id,
"state" => "pending"
}
"object" => followed_id,
"state" => "pending"
}
- |>
maybe_pu
t("id", activity_id)
+ |>
Maps.put_if_presen
t("id", activity_id)
end
def fetch_latest_follow(%User{ap_id: follower_id}, %User{ap_id: followed_id}) do
end
def fetch_latest_follow(%User{ap_id: follower_id}, %User{ap_id: followed_id}) do
@@
-546,7
+547,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
"cc" => [],
"context" => object.data["context"]
}
"cc" => [],
"context" => object.data["context"]
}
- |>
maybe_pu
t("id", activity_id)
+ |>
Maps.put_if_presen
t("id", activity_id)
end
def make_announce_data(
end
def make_announce_data(
@@
-563,7
+564,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
"cc" => [Pleroma.Constants.as_public()],
"context" => object.data["context"]
}
"cc" => [Pleroma.Constants.as_public()],
"context" => object.data["context"]
}
- |>
maybe_pu
t("id", activity_id)
+ |>
Maps.put_if_presen
t("id", activity_id)
end
def make_undo_data(
end
def make_undo_data(
@@
-582,7
+583,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
"cc" => [Pleroma.Constants.as_public()],
"context" => context
}
"cc" => [Pleroma.Constants.as_public()],
"context" => context
}
- |>
maybe_pu
t("id", activity_id)
+ |>
Maps.put_if_presen
t("id", activity_id)
end
@spec add_announce_to_object(Activity.t(), Object.t()) ::
end
@spec add_announce_to_object(Activity.t(), Object.t()) ::
@@
-627,7
+628,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
"to" => [followed.ap_id],
"object" => follow_activity.data
}
"to" => [followed.ap_id],
"object" => follow_activity.data
}
- |>
maybe_pu
t("id", activity_id)
+ |>
Maps.put_if_presen
t("id", activity_id)
end
#### Block-related helpers
end
#### Block-related helpers
@@
-650,7
+651,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
"to" => [blocked.ap_id],
"object" => blocked.ap_id
}
"to" => [blocked.ap_id],
"object" => blocked.ap_id
}
- |>
maybe_pu
t("id", activity_id)
+ |>
Maps.put_if_presen
t("id", activity_id)
end
#### Create-related helpers
end
#### Create-related helpers
@@
-740,6
+741,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
def get_reports(params, page, page_size) do
params =
params
def get_reports(params, page, page_size) do
params =
params
+ |> Map.new(fn {key, value} -> {to_string(key), value} end)
|> Map.put("type", "Flag")
|> Map.put("skip_preload", true)
|> Map.put("preload_report_notes", true)
|> Map.put("type", "Flag")
|> Map.put("skip_preload", true)
|> Map.put("preload_report_notes", true)
@@
-870,7
+872,4
@@
defmodule Pleroma.Web.ActivityPub.Utils do
|> where([a, object: o], fragment("(?)->>'type' = 'Answer'", o.data))
|> Repo.all()
end
|> where([a, object: o], fragment("(?)->>'type' = 'Answer'", o.data))
|> Repo.all()
end
-
- def maybe_put(map, _key, nil), do: map
- def maybe_put(map, key, value), do: Map.put(map, key, value)
end
end