small fix for elixir 1.13
Environment
- Installation type (OTP or From Source): Source
- Pleroma version (could be found in the "Version" tab of settings in Pleroma-FE): 2.4.51-185-g613f55b0-develop
- Elixir version (
elixir -v
for from source installations, N/A for OTP): Elixir 1.13.0 (compiled with Erlang/OTP 24) -- asdf - Operating system: Ubuntu 20.04
- PostgreSQL version (
psql -V
): 13.5
Bug description
Building with Elixir 1.13.0 fails with
warning: variable "result" does not exist and is being expanded to "result()", please use parentheses to remove the ambiguity or change the variable name
lib/pleroma/web/activity_pub/publisher.ex:82: Pleroma.Web.ActivityPub.Publisher.publish_one/1
warning: variable "result" is unused (if the variable is not meant to be used, prefix it with an underscore)
lib/pleroma/web/activity_pub/publisher.ex:67: Pleroma.Web.ActivityPub.Publisher.publish_one/1
== Compilation error in file lib/pleroma/web/activity_pub/publisher.ex ==
** (CompileError) lib/pleroma/web/activity_pub/publisher.ex:82: undefined function result/0 (expected Pleroma.Web.ActivityPub.Publisher to define such a function or for it to be imported, but none are available)
Fix:
--- a/lib/pleroma/web/activity_pub/publisher.ex
+++ b/lib/pleroma/web/activity_pub/publisher.ex
@@ -63,8 +63,7 @@ def publish_one(%{inbox: inbox, json: json, actor: %User{} = actor, id: id} = pa
date: date
})
- with {:ok, %{status: code}} when code in 200..299 <-
- result =
+ with {:ok, %{status: code} = result} when code in 200..299 <-
HTTP.post(
inbox,
json,