Elixir 1.18 Remove seemingly unneeded cond

warning: this clause in cond will always match:

<<"#", name::binary>>

since it has type:

binary()

where "name" was given the type:

%{"type" => "Hashtag", "name" => name} = data

   typing violation found at:
   │
55 │         "#" <> name -> name
   │                     ~
   │
   └─ lib/pleroma/web/activity_pub/object_validators/tag_validator.ex:55:21: Pleroma.Web.ActivityPub.ObjectValidators.TagValidator.changeset/2
This commit is contained in:
Phantasm 2025-05-12 17:21:41 +02:00
commit 25e7b12a6b
No known key found for this signature in database
GPG key ID: 2669E588BCC634C8

View file

@ -50,12 +50,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.TagValidator do
end
def changeset(struct, %{"type" => "Hashtag", "name" => name} = data) do
name =
cond do
"#" <> name -> name
name -> name
end
|> String.downcase()
name = String.downcase(name)
data = Map.put(data, "name", name)