Compare commits

..

No commits in common. "02bdaef80d8bda33699355946ca069abb0e9bc4c" and "144bfb57e24cd0a5a14c23a615086a014ef4ce03" have entirely different histories.

5 changed files with 17 additions and 14 deletions

View file

@ -96,11 +96,15 @@ defmodule Nulla.ActivityPub do
type: "Note", type: "Note",
summary: nil, summary: nil,
inReplyTo: note.inReplyTo, inReplyTo: note.inReplyTo,
published: note.published, published: note.inserted_at,
url: note.url, url: note.url,
attributedTo: note.actor.ap_id, attributedTo: note.actor.ap_id,
to: note.to, to: [
cc: note.cc, "https://www.w3.org/ns/activitystreams#Public"
],
cc: [
"#{note.actor.ap_id}/followers"
],
sensitive: note.sensitive, sensitive: note.sensitive,
content: note.content, content: note.content,
contentMap: Jason.OrderedObject.new("#{note.language}": note.content), contentMap: Jason.OrderedObject.new("#{note.language}": note.content),
@ -337,7 +341,6 @@ defmodule Nulla.ActivityPub do
to: [ to: [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
cc: [],
object: object:
Jason.OrderedObject.new( Jason.OrderedObject.new(
id: "#{note.actor.ap_id}/notes/#{note.id}", id: "#{note.actor.ap_id}/notes/#{note.id}",

View file

@ -11,8 +11,8 @@ defmodule Nulla.Models.Activity do
field :type, :string field :type, :string
field :actor, :string field :actor, :string
field :object, :string field :object, :string
field :to, {:array, :string} field :to, :string
field :cc, {:array, :string} field :cc, :string
timestamps() timestamps()
end end

View file

@ -10,10 +10,12 @@ defmodule Nulla.Models.Note do
@primary_key {:id, :integer, autogenerate: false} @primary_key {:id, :integer, autogenerate: false}
schema "notes" do schema "notes" do
field :inReplyTo, :string field :inReplyTo, :string
field :published, :utc_datetime
field :url, :string field :url, :string
field :to, {:array, :string}
field :cc, {:array, :string} field :visibility, Ecto.Enum,
values: [:public, :unlisted, :followers, :private],
default: :public
field :sensitive, :boolean, default: false field :sensitive, :boolean, default: false
field :content, :string field :content, :string
field :language, :string field :language, :string

View file

@ -5,10 +5,8 @@ defmodule Nulla.Repo.Migrations.CreateNotes do
create table(:notes, primary_key: false) do create table(:notes, primary_key: false) do
add :id, :bigint, primary_key: true add :id, :bigint, primary_key: true
add :inReplyTo, :string add :inReplyTo, :string
add :published, :utc_datetime
add :url, :string add :url, :string
add :to, {:array, :string} add :visibility, :string, default: "public"
add :cc, {:array, :string}
add :sensitive, :boolean, default: false add :sensitive, :boolean, default: false
add :content, :text add :content, :text
add :language, :string add :language, :string

View file

@ -8,8 +8,8 @@ defmodule Nulla.Repo.Migrations.CreateActivities do
add :type, :string, null: false add :type, :string, null: false
add :actor, :string, null: false add :actor, :string, null: false
add :object, :text, null: false add :object, :text, null: false
add :to, {:array, :string} add :to, :text
add :cc, {:array, :string} add :cc, :text
timestamps() timestamps()
end end