aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/user.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/user.ex')
-rw-r--r--lib/pleroma/user.ex16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 3fb298d05..6d9fe623d 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -1,5 +1,6 @@
defmodule Pleroma.User do
use Ecto.Schema
+ alias Pleroma.User
schema "users" do
field :bio, :string
@@ -7,7 +8,22 @@ defmodule Pleroma.User do
field :name, :string
field :nickname, :string
field :password_hash, :string
+ field :following, { :array, :string }, default: []
+ field :ap_id, :string
timestamps()
end
+
+ def ap_id(%User{nickname: nickname}) do
+ host =
+ Application.get_env(:pleroma, Pleroma.Web.Endpoint)
+ |> Keyword.fetch!(:url)
+ |> Keyword.fetch!(:host)
+
+ "https://#{host}/users/#{nickname}"
+ end
+
+ def ap_followers(%User{} = user) do
+ "#{ap_id(user)}/followers"
+ end
end