projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Transmogrifier: Strip internal emoji reaction fields.
[akkoma]
/
lib
/
pleroma
/
list.ex
diff --git
a/lib/pleroma/list.ex
b/lib/pleroma/list.ex
index 16955b3b559bf3f34bd339941a1267be58a814bc..c572380c2325b90e0dd58e26a7e71789401c67bc 100644
(file)
--- a/
lib/pleroma/list.ex
+++ b/
lib/pleroma/list.ex
@@
-109,15
+109,19
@@
defmodule Pleroma.List do
end
def create(title, %User{} = creator) do
end
def create(title, %User{} = creator) do
- list = %Pleroma.List{user_id: creator.id, title: title}
+ changeset = title_changeset(%Pleroma.List{user_id: creator.id}, %{title: title})
- Repo.transaction(fn ->
- list = Repo.insert!(list)
+ if changeset.valid? do
+ Repo.transaction(fn ->
+ list = Repo.insert!(changeset)
- list
- |> change(ap_id: "#{creator.ap_id}/lists/#{list.id}")
- |> Repo.update!()
- end)
+ list
+ |> change(ap_id: "#{creator.ap_id}/lists/#{list.id}")
+ |> Repo.update!()
+ end)
+ else
+ {:error, changeset}
+ end
end
def follow(%Pleroma.List{following: following} = list, %User{} = followed) do
end
def follow(%Pleroma.List{following: following} = list, %User{} = followed) do
@@
-146,4
+150,10
@@
defmodule Pleroma.List do
end
def memberships(_), do: []
end
def memberships(_), do: []
+
+ def member?(%Pleroma.List{following: following}, %User{follower_address: follower_address}) do
+ Enum.member?(following, follower_address)
+ end
+
+ def member?(_, _), do: false
end
end