Commit 56bacc90 authored by lain's avatar lain
Browse files

Fix specs, add local marker to actitivies.

parent 89c1e90e
......@@ -5,6 +5,7 @@ defmodule Pleroma.Activity do
schema "activities" do
field :data, :map
field :local, :boolean, default: true
timestamps()
end
......
defmodule Pleroma.Repo.Migrations.AddLocalFieldToActivities do
use Ecto.Migration
def change do
alter table(:activities) do
add :local, :boolean, default: true
end
create index(:activities, [:local])
end
end
......@@ -5,7 +5,7 @@ defmodule Pleroma.Builders.ActivityBuilder do
def build(data \\ %{}, opts \\ %{}) do
user = opts[:user] || Pleroma.Factory.insert(:user)
activity = %{
"id" => 1,
"id" => Pleroma.Web.ActivityPub.ActivityPub.generate_object_id,
"actor" => user.ap_id,
"to" => ["https://www.w3.org/ns/activitystreams#Public"],
"object" => %{
......@@ -23,7 +23,7 @@ def insert(data \\ %{}, opts \\ %{}) do
def insert_list(times, data \\ %{}, opts \\ %{}) do
Enum.map(1..times, fn (n) ->
{:ok, activity} = insert(Map.merge(data, %{"id" => n}))
{:ok, activity} = insert(data)
activity
end)
end
......
......@@ -40,6 +40,7 @@ test "create a status" do
assert Enum.member?(get_in(activity.data, ["to"]), User.ap_followers(user))
assert Enum.member?(get_in(activity.data, ["to"]), "https://www.w3.org/ns/activitystreams#Public")
assert Enum.member?(get_in(activity.data, ["to"]), "shp")
assert activity.local == true
# Add a context
assert is_binary(get_in(activity.data, ["context"]))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment