projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[#3251] Fixed wrong test-env config setting for [Pleroma.Upload]. Refactoring. Added...
[akkoma]
/
test
/
support
/
builders
/
activity_builder.ex
diff --git
a/test/support/builders/activity_builder.ex
b/test/support/builders/activity_builder.ex
index 0ebf633b3d57a74adb5335e699a9c5618e58249f..7c4950bfa08a6b9559f587daa3e7bc5a49b77b24 100644
(file)
--- a/
test/support/builders/activity_builder.ex
+++ b/
test/support/builders/activity_builder.ex
@@
-1,30
+1,39
@@
defmodule Pleroma.Builders.ActivityBuilder do
defmodule Pleroma.Builders.ActivityBuilder do
- alias Pleroma.Builders.UserBuilder
alias Pleroma.Web.ActivityPub.ActivityPub
def build(data \\ %{}, opts \\ %{}) do
user = opts[:user] || Pleroma.Factory.insert(:user)
alias Pleroma.Web.ActivityPub.ActivityPub
def build(data \\ %{}, opts \\ %{}) do
user = opts[:user] || Pleroma.Factory.insert(:user)
+
activity = %{
activity = %{
- "id" => Pleroma.Web.ActivityPub.Utils.generate_object_id,
+ "id" => Pleroma.Web.ActivityPub.Utils.generate_object_id
()
,
"actor" => user.ap_id,
"to" => ["https://www.w3.org/ns/activitystreams#Public"],
"type" => "Create",
"object" => %{
"type" => "Note",
"content" => "test",
"actor" => user.ap_id,
"to" => ["https://www.w3.org/ns/activitystreams#Public"],
"type" => "Create",
"object" => %{
"type" => "Note",
"content" => "test",
- "to" => ["https://www.w3.org/ns/activitystreams#Public"]
,
+ "to" => ["https://www.w3.org/ns/activitystreams#Public"]
}
}
}
}
+
Map.merge(activity, data)
end
def insert(data \\ %{}, opts \\ %{}) do
activity = build(data, opts)
Map.merge(activity, data)
end
def insert(data \\ %{}, opts \\ %{}) do
activity = build(data, opts)
- ActivityPub.insert(activity)
+
+ case ActivityPub.insert(activity) do
+ ok = {:ok, activity} ->
+ ActivityPub.notify_and_stream(activity)
+ ok
+
+ error ->
+ error
+ end
end
def insert_list(times, data \\ %{}, opts \\ %{}) do
end
def insert_list(times, data \\ %{}, opts \\ %{}) do
- Enum.map(1..times, fn
(n)
->
+ Enum.map(1..times, fn
_n
->
{:ok, activity} = insert(data, opts)
activity
end)
{:ok, activity} = insert(data, opts)
activity
end)