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
/
user.ex
diff --git
a/lib/pleroma/user.ex
b/lib/pleroma/user.ex
index cf72985fe757faa5e7c5cb08b3efb95a96f1f8d6..09ea8079391b6b8c7c882ee7d19778e58c1bce42 100644
(file)
--- a/
lib/pleroma/user.ex
+++ b/
lib/pleroma/user.ex
@@
-813,7
+813,8
@@
defmodule Pleroma.User do
def send_welcome_email(_), do: {:ok, :noop}
@spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop}
def send_welcome_email(_), do: {:ok, :noop}
@spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop}
- def try_send_confirmation_email(%User{confirmation_pending: true} = user) do
+ def try_send_confirmation_email(%User{confirmation_pending: true, email: email} = user)
+ when is_binary(email) do
if Config.get([:instance, :account_activation_required]) do
send_confirmation_email(user)
{:ok, :enqueued}
if Config.get([:instance, :account_activation_required]) do
send_confirmation_email(user)
{:ok, :enqueued}
@@
-914,9
+915,7
@@
defmodule Pleroma.User do
FollowingRelationship.unfollow(follower, followed)
{:ok, followed} = update_follower_count(followed)
FollowingRelationship.unfollow(follower, followed)
{:ok, followed} = update_follower_count(followed)
- {:ok, follower} =
- follower
- |> update_following_count()
+ {:ok, follower} = update_following_count(follower)
{:ok, follower, followed}
{:ok, follower, followed}
@@
-1769,12
+1768,12
@@
defmodule Pleroma.User do
def html_filter_policy(_), do: Config.get([:markup, :scrub_policy])
def html_filter_policy(_), do: Config.get([:markup, :scrub_policy])
- def fetch_by_ap_id(ap_id
), do: ActivityPub.make_user_from_ap_id(ap_id
)
+ def fetch_by_ap_id(ap_id
, opts \\ []), do: ActivityPub.make_user_from_ap_id(ap_id, opts
)
- def get_or_fetch_by_ap_id(ap_id) do
+ def get_or_fetch_by_ap_id(ap_id
, opts \\ []
) do
cached_user = get_cached_by_ap_id(ap_id)
cached_user = get_cached_by_ap_id(ap_id)
- maybe_fetched_user = needs_update?(cached_user) && fetch_by_ap_id(ap_id)
+ maybe_fetched_user = needs_update?(cached_user) && fetch_by_ap_id(ap_id
, opts
)
case {cached_user, maybe_fetched_user} do
{_, {:ok, %User{} = user}} ->
case {cached_user, maybe_fetched_user} do
{_, {:ok, %User{} = user}} ->
@@
-1847,8
+1846,8
@@
defmodule Pleroma.User do
def public_key(_), do: {:error, "key not found"}
def public_key(_), do: {:error, "key not found"}
- def get_public_key_for_ap_id(ap_id) do
- with {:ok, %User{} = user} <- get_or_fetch_by_ap_id(ap_id),
+ def get_public_key_for_ap_id(ap_id
, opts \\ []
) do
+ with {:ok, %User{} = user} <- get_or_fetch_by_ap_id(ap_id
, opts
),
{:ok, public_key} <- public_key(user) do
{:ok, public_key}
else
{:ok, public_key} <- public_key(user) do
{:ok, public_key}
else
@@
-2071,6
+2070,13
@@
defmodule Pleroma.User do
Enum.map(users, &toggle_confirmation/1)
end
Enum.map(users, &toggle_confirmation/1)
end
+ @spec need_confirmation(User.t(), boolean()) :: {:ok, User.t()} | {:error, Changeset.t()}
+ def need_confirmation(%User{} = user, bool) do
+ user
+ |> confirmation_changeset(need_confirmation: bool)
+ |> update_and_set_cache()
+ end
+
def get_mascot(%{mascot: %{} = mascot}) when not is_nil(mascot) do
mascot
end
def get_mascot(%{mascot: %{} = mascot}) when not is_nil(mascot) do
mascot
end
@@
-2285,7
+2291,9
@@
defmodule Pleroma.User do
# if pinned activity was scheduled for deletion, we reschedule it for deletion
if data["expires_at"] do
# if pinned activity was scheduled for deletion, we reschedule it for deletion
if data["expires_at"] do
- {:ok, expires_at, _} = DateTime.from_iso8601(data["expires_at"])
+ # MRF.ActivityExpirationPolicy used UTC timestamps for expires_at in original implementation
+ {:ok, expires_at} =
+ data["expires_at"] |> Pleroma.EctoType.ActivityPub.ObjectValidators.DateTime.cast()
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
activity_id: id,
Pleroma.Workers.PurgeExpiredActivity.enqueue(%{
activity_id: id,