summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.d/group-repeats.fix1
-rw-r--r--changelog.d/ldap-error-logging.change1
-rw-r--r--lib/pleroma/web/activity_pub/utils.ex24
-rw-r--r--lib/pleroma/web/auth/ldap_authenticator.ex6
4 files changed, 12 insertions, 20 deletions
diff --git a/changelog.d/group-repeats.fix b/changelog.d/group-repeats.fix
new file mode 100644
index 000000000..d465122dd
--- /dev/null
+++ b/changelog.d/group-repeats.fix
@@ -0,0 +1 @@
+Deactivated groups would still try to repeat a post.
diff --git a/changelog.d/ldap-error-logging.change b/changelog.d/ldap-error-logging.change
new file mode 100644
index 000000000..56f0e7fc3
--- /dev/null
+++ b/changelog.d/ldap-error-logging.change
@@ -0,0 +1 @@
+Improve error logging when LDAP authentication fails.
diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex
index 797e79dda..6c792804d 100644
--- a/lib/pleroma/web/activity_pub/utils.ex
+++ b/lib/pleroma/web/activity_pub/utils.ex
@@ -939,26 +939,14 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|> Repo.all()
end
+ @spec maybe_handle_group_posts(Activity.t()) :: :ok
+ @doc "Automatically repeats posts for local group actor recipients"
def maybe_handle_group_posts(activity) do
poster = User.get_cached_by_ap_id(activity.actor)
- mentions =
- activity.data["to"]
- |> Enum.filter(&(&1 != activity.actor))
-
- mentioned_local_groups =
- User.get_all_by_ap_id(mentions)
- |> Enum.filter(fn user ->
- user.actor_type == "Group" and
- user.local and
- not User.blocks?(user, poster)
- end)
-
- mentioned_local_groups
- |> Enum.each(fn group ->
- Pleroma.Web.CommonAPI.repeat(activity.id, group)
- end)
-
- :ok
+ User.get_recipients_from_activity(activity)
+ |> Enum.filter(&match?("Group", &1.actor_type))
+ |> Enum.reject(&User.blocks?(&1, poster))
+ |> Enum.each(&Pleroma.Web.CommonAPI.repeat(activity.id, &1))
end
end
diff --git a/lib/pleroma/web/auth/ldap_authenticator.ex b/lib/pleroma/web/auth/ldap_authenticator.ex
index c2c5eb1e5..ea5620cf6 100644
--- a/lib/pleroma/web/auth/ldap_authenticator.ex
+++ b/lib/pleroma/web/auth/ldap_authenticator.ex
@@ -91,7 +91,8 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do
end
error ->
- error
+ Logger.error("Could not bind LDAP user #{name}: #{inspect(error)}")
+ {:error, {:ldap_bind_error, error}}
end
end
@@ -111,7 +112,8 @@ defmodule Pleroma.Web.Auth.LDAPAuthenticator do
try_register(name, attributes)
error ->
- error
+ Logger.error("Couldn't register user because LDAP search failed: #{inspect(error)}")
+ {:error, {:ldap_search_error, error}}
end
end