projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
files consistency after rebase
[akkoma]
/
lib
/
pleroma
/
bookmark.ex
diff --git
a/lib/pleroma/bookmark.ex
b/lib/pleroma/bookmark.ex
index d976f949c4f549cae5be55bf43eb05470cab70f9..e6ddbce1b688af70364f2442793f5589efd10c66 100644
(file)
--- a/
lib/pleroma/bookmark.ex
+++ b/
lib/pleroma/bookmark.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Bookmark do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Bookmark do
@@
-10,20
+10,20
@@
defmodule Pleroma.Bookmark do
alias Pleroma.Activity
alias Pleroma.Bookmark
alias Pleroma.Activity
alias Pleroma.Bookmark
- alias Pleroma.FlakeId
alias Pleroma.Repo
alias Pleroma.User
@type t :: %__MODULE__{}
schema "bookmarks" do
alias Pleroma.Repo
alias Pleroma.User
@type t :: %__MODULE__{}
schema "bookmarks" do
- belongs_to(:user, User, type: FlakeId)
- belongs_to(:activity, Activity, type: FlakeId)
+ belongs_to(:user, User, type: FlakeId
.Ecto.CompatType
)
+ belongs_to(:activity, Activity, type: FlakeId
.Ecto.CompatType
)
timestamps()
end
timestamps()
end
- @spec create(FlakeId.t(), FlakeId.t()) :: {:ok, Bookmark.t()} | {:error, Changeset.t()}
+ @spec create(FlakeId.Ecto.CompatType.t(), FlakeId.Ecto.CompatType.t()) ::
+ {:ok, Bookmark.t()} | {:error, Changeset.t()}
def create(user_id, activity_id) do
attrs = %{
user_id: user_id,
def create(user_id, activity_id) do
attrs = %{
user_id: user_id,
@@
-37,7
+37,7
@@
defmodule Pleroma.Bookmark do
|> Repo.insert()
end
|> Repo.insert()
end
- @spec for_user_query(FlakeId.t()) :: Ecto.Query.t()
+ @spec for_user_query(FlakeId.
Ecto.CompatType.
t()) :: Ecto.Query.t()
def for_user_query(user_id) do
Bookmark
|> where(user_id: ^user_id)
def for_user_query(user_id) do
Bookmark
|> where(user_id: ^user_id)
@@
-52,7
+52,8
@@
defmodule Pleroma.Bookmark do
|> Repo.one()
end
|> Repo.one()
end
- @spec destroy(FlakeId.t(), FlakeId.t()) :: {:ok, Bookmark.t()} | {:error, Changeset.t()}
+ @spec destroy(FlakeId.Ecto.CompatType.t(), FlakeId.Ecto.CompatType.t()) ::
+ {:ok, Bookmark.t()} | {:error, Changeset.t()}
def destroy(user_id, activity_id) do
from(b in Bookmark,
where: b.user_id == ^user_id,
def destroy(user_id, activity_id) do
from(b in Bookmark,
where: b.user_id == ^user_id,