projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BBS: small fixes.
[akkoma]
/
lib
/
pleroma
/
user.ex
diff --git
a/lib/pleroma/user.ex
b/lib/pleroma/user.ex
index 755d8f773f96e67e56362aef6aaab8e02d266561..1741ce684716fec3e1dfb2a9a16a0dd3fcb2a96f 100644
(file)
--- a/
lib/pleroma/user.ex
+++ b/
lib/pleroma/user.ex
@@
-11,7
+11,6
@@
defmodule Pleroma.User do
alias Comeonin.Pbkdf2
alias Pleroma.Activity
alias Pleroma.Bookmark
alias Comeonin.Pbkdf2
alias Pleroma.Activity
alias Pleroma.Bookmark
- alias Pleroma.Formatter
alias Pleroma.Notification
alias Pleroma.Object
alias Pleroma.Registration
alias Pleroma.Notification
alias Pleroma.Object
alias Pleroma.Registration
@@
-513,7
+512,7
@@
defmodule Pleroma.User do
case user_result do
{:ok, user} -> {:commit, user}
case user_result do
{:ok, user} -> {:commit, user}
- {:error,
error} -> {:ignore, error
}
+ {:error,
_error} -> {:ignore, nil
}
end
end)
end
end
end)
end
@@
-563,7
+562,7
@@
defmodule Pleroma.User do
{:ok, user}
else
{:ok, user}
else
-
e -> {:error,
e}
+
_e -> {:error, "not found " <> nicknam
e}
end
end
end
end
end
end
@@
-1210,11
+1209,11
@@
defmodule Pleroma.User do
case ap_try do
{:ok, user} ->
case ap_try do
{:ok, user} ->
- user
+ {:ok, user}
_ ->
case OStatus.make_user(ap_id) do
_ ->
case OStatus.make_user(ap_id) do
- {:ok, user} ->
user
+ {:ok, user} ->
{:ok, user}
_ -> {:error, "Could not fetch by AP id"}
end
end
_ -> {:error, "Could not fetch by AP id"}
end
end
@@
-1229,15
+1228,15
@@
defmodule Pleroma.User do
# Whether to fetch initial posts for the user (if it's a new user & the fetching is enabled)
should_fetch_initial = is_nil(user) and Pleroma.Config.get([:fetch_initial_posts, :enabled])
# Whether to fetch initial posts for the user (if it's a new user & the fetching is enabled)
should_fetch_initial = is_nil(user) and Pleroma.Config.get([:fetch_initial_posts, :enabled])
+ resp = fetch_by_ap_id(ap_id)
+
if should_fetch_initial do
if should_fetch_initial do
- with {:ok, %User{} = user} =
fetch_by_ap_id(ap_id)
do
+ with {:ok, %User{} = user} =
resp
do
{:ok, _} = Task.start(__MODULE__, :fetch_initial_posts, [user])
end
{:ok, _} = Task.start(__MODULE__, :fetch_initial_posts, [user])
end
-
- {:ok, user}
- else
- _ -> {:error, "Could not fetch by AP id"}
end
end
+
+ resp
end
end
end
end
@@
-1331,18
+1330,15
@@
defmodule Pleroma.User do
end
end
end
end
- def parse_bio(bio, user \\ %User{info: %{source_data: %{}}})
- def parse_bio(nil, _user), do: ""
- def parse_bio(bio, _user) when bio == "", do: bio
+ def parse_bio(bio) when is_binary(bio) and bio != "" do
+ bio
+ |> CommonUtils.format_input("text/plain", mentions_format: :full)
+ |> elem(0)
+ end
- def parse_bio(bio, user) do
- emoji =
- (user.info.source_data["tag"] || [])
- |> Enum.filter(fn %{"type" => t} -> t == "Emoji" end)
- |> Enum.map(fn %{"icon" => %{"url" => url}, "name" => name} ->
- {String.trim(name, ":"), url}
- end)
+ def parse_bio(_), do: ""
+ def parse_bio(bio, user) when is_binary(bio) and bio != "" do
# TODO: get profile URLs other than user.ap_id
profile_urls = [user.ap_id]
# TODO: get profile URLs other than user.ap_id
profile_urls = [user.ap_id]
@@
-1352,9
+1348,10
@@
defmodule Pleroma.User do
rel: &RelMe.maybe_put_rel_me(&1, profile_urls)
)
|> elem(0)
rel: &RelMe.maybe_put_rel_me(&1, profile_urls)
)
|> elem(0)
- |> Formatter.emojify(emoji)
end
end
+ def parse_bio(_, _), do: ""
+
def tag(user_identifiers, tags) when is_list(user_identifiers) do
Repo.transaction(fn ->
for user_identifier <- user_identifiers, do: tag(user_identifier, tags)
def tag(user_identifiers, tags) when is_list(user_identifiers) do
Repo.transaction(fn ->
for user_identifier <- user_identifiers, do: tag(user_identifier, tags)