projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'feature/list-streaming' into 'develop'
[akkoma]
/
lib
/
pleroma
/
web
/
common_api
/
utils.ex
diff --git
a/lib/pleroma/web/common_api/utils.ex
b/lib/pleroma/web/common_api/utils.ex
index e774743a2736c41d1410e1ada51088b296237506..30089f553abbbf1646f6cd6e748bdd0828dfd7c3 100644
(file)
--- a/
lib/pleroma/web/common_api/utils.ex
+++ b/
lib/pleroma/web/common_api/utils.ex
@@
-9,11
+9,12
@@
defmodule Pleroma.Web.CommonAPI.Utils do
def get_by_id_or_ap_id(id) do
activity = Repo.get(Activity, id) || Activity.get_create_activity_by_object_ap_id(id)
def get_by_id_or_ap_id(id) do
activity = Repo.get(Activity, id) || Activity.get_create_activity_by_object_ap_id(id)
- if activity.data["type"] == "Create" do
- activity
- else
- Activity.get_create_activity_by_object_ap_id(activity.data["object"])
- end
+ activity &&
+ if activity.data["type"] == "Create" do
+ activity
+ else
+ Activity.get_create_activity_by_object_ap_id(activity.data["object"])
+ end
end
def get_replied_to_activity(id) when not is_nil(id) do
end
def get_replied_to_activity(id) when not is_nil(id) do
@@
-133,7
+134,7
@@
defmodule Pleroma.Web.CommonAPI.Utils do
"context" => context,
"attachment" => attachments,
"actor" => actor,
"context" => context,
"attachment" => attachments,
"actor" => actor,
- "tag" => tags |> Enum.map(fn {_, tag} -> tag end)
+ "tag" => tags |> Enum.map(fn {_, tag} -> tag end)
|> Enum.uniq()
}
if inReplyTo do
}
if inReplyTo do
@@
-187,9
+188,9
@@
defmodule Pleroma.Web.CommonAPI.Utils do
end
end
end
end
- def confirm_current_password(user, pa
rams
) do
+ def confirm_current_password(user, pa
ssword
) do
with %User{local: true} = db_user <- Repo.get(User, user.id),
with %User{local: true} = db_user <- Repo.get(User, user.id),
- true <- Pbkdf2.checkpw(pa
rams["password"]
, db_user.password_hash) do
+ true <- Pbkdf2.checkpw(pa
ssword
, db_user.password_hash) do
{:ok, db_user}
else
_ -> {:error, "Invalid password."}
{:ok, db_user}
else
_ -> {:error, "Invalid password."}