projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'fix/ap-icon' into 'develop'
[akkoma]
/
lib
/
pleroma
/
user.ex
diff --git
a/lib/pleroma/user.ex
b/lib/pleroma/user.ex
index f2ef0a838e87b9f9c8998146fe312734e14a9a7e..3beebd1216394b3abe2c48aedfe7e2751681cc34 100644
(file)
--- a/
lib/pleroma/user.ex
+++ b/
lib/pleroma/user.ex
@@
-60,14
+60,10
@@
defmodule Pleroma.User do
timestamps()
end
timestamps()
end
- def auth_active?(%User{local: false}), do: true
-
- def auth_active?(%User{info: %User.Info{confirmation_pending: false}}), do: true
-
def auth_active?(%User{info: %User.Info{confirmation_pending: true}}),
do: !Pleroma.Config.get([:instance, :account_activation_required])
def auth_active?(%User{info: %User.Info{confirmation_pending: true}}),
do: !Pleroma.Config.get([:instance, :account_activation_required])
- def auth_active?(
_), do: fals
e
+ def auth_active?(
%User{}), do: tru
e
def visible_for?(user, for_user \\ nil)
def visible_for?(user, for_user \\ nil)
@@
-83,17
+79,17
@@
defmodule Pleroma.User do
def superuser?(%User{local: true, info: %User.Info{is_moderator: true}}), do: true
def superuser?(_), do: false
def superuser?(%User{local: true, info: %User.Info{is_moderator: true}}), do: true
def superuser?(_), do: false
- def avatar_url(user) do
+ def avatar_url(user
, options \\ []
) do
case user.avatar do
%{"url" => [%{"href" => href} | _]} -> href
case user.avatar do
%{"url" => [%{"href" => href} | _]} -> href
- _ -> "#{Web.base_url()}/images/avi.png"
+ _ ->
!options[:no_default] &&
"#{Web.base_url()}/images/avi.png"
end
end
end
end
- def banner_url(user) do
+ def banner_url(user
, options \\ []
) do
case user.info.banner do
%{"url" => [%{"href" => href} | _]} -> href
case user.info.banner do
%{"url" => [%{"href" => href} | _]} -> href
- _ -> "#{Web.base_url()}/images/banner.png"
+ _ ->
!options[:no_default] &&
"#{Web.base_url()}/images/banner.png"
end
end
end
end
@@
-1110,13
+1106,15
@@
defmodule Pleroma.User do
friends
|> Enum.each(fn followed -> User.unfollow(user, followed) end)
friends
|> Enum.each(fn followed -> User.unfollow(user, followed) end)
- query = from(a in Activity, where: a.actor == ^user.ap_id)
+ query =
+ from(a in Activity, where: a.actor == ^user.ap_id)
+ |> Activity.with_preloaded_object()
Repo.all(query)
|> Enum.each(fn activity ->
case activity.data["type"] do
"Create" ->
Repo.all(query)
|> Enum.each(fn activity ->
case activity.data["type"] do
"Create" ->
- ActivityPub.delete(Object.normalize(activity
.data["object"]
))
+ ActivityPub.delete(Object.normalize(activity))
# TODO: Do something with likes, follows, repeats.
_ ->
# TODO: Do something with likes, follows, repeats.
_ ->