projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'fix-recipients-from-activity' into 'develop'
[akkoma]
/
lib
/
pleroma
/
delivery.ex
diff --git
a/lib/pleroma/delivery.ex
b/lib/pleroma/delivery.ex
index ce8fb96f40dbc09cb0955c69dc553b20ea96fab4..1d586a2524b3afd6c584b286e8e5a09bab7b3e17 100644
(file)
--- a/
lib/pleroma/delivery.ex
+++ b/
lib/pleroma/delivery.ex
@@
-6,7
+6,6
@@
defmodule Pleroma.Delivery do
use Ecto.Schema
alias Pleroma.Delivery
use Ecto.Schema
alias Pleroma.Delivery
- alias Pleroma.FlakeId
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.User
@@
-16,13
+15,14
@@
defmodule Pleroma.Delivery do
import Ecto.Query
schema "deliveries" do
import Ecto.Query
schema "deliveries" do
- belongs_to(:user, User, type: FlakeId)
+ belongs_to(:user, User, type: FlakeId
.Ecto.CompatType
)
belongs_to(:object, Object)
end
def changeset(delivery, params \\ %{}) do
delivery
|> cast(params, [:user_id, :object_id])
belongs_to(:object, Object)
end
def changeset(delivery, params \\ %{}) do
delivery
|> cast(params, [:user_id, :object_id])
+ |> validate_required([:user_id, :object_id])
|> foreign_key_constraint(:object_id)
|> foreign_key_constraint(:user_id)
|> unique_constraint(:user_id, name: :deliveries_user_id_object_id_index)
|> foreign_key_constraint(:object_id)
|> foreign_key_constraint(:user_id)
|> unique_constraint(:user_id, name: :deliveries_user_id_object_id_index)
@@
-31,7
+31,7
@@
defmodule Pleroma.Delivery do
def create(object_id, user_id) do
%Delivery{}
|> changeset(%{user_id: user_id, object_id: object_id})
def create(object_id, user_id) do
%Delivery{}
|> changeset(%{user_id: user_id, object_id: object_id})
- |> Repo.insert()
+ |> Repo.insert(
on_conflict: :nothing
)
end
def get(object_id, user_id) do
end
def get(object_id, user_id) do