CommonValidations: Remove superfluous function
authorlain <lain@soykaf.club>
Wed, 5 Aug 2020 10:24:34 +0000 (12:24 +0200)
committerlain <lain@soykaf.club>
Wed, 5 Aug 2020 10:24:34 +0000 (12:24 +0200)
The `is_active` functionality was integrated into the presence
checker.

lib/pleroma/web/activity_pub/object_validators/answer_validator.ex
lib/pleroma/web/activity_pub/object_validators/common_validations.ex
lib/pleroma/web/activity_pub/object_validators/create_generic_validator.ex
lib/pleroma/web/activity_pub/object_validators/question_validator.ex

index ebddd50381051768bef640f92cd58771b43a4a15..3233676427012dc968c164729987d69052372164 100644 (file)
@@ -59,7 +59,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnswerValidator do
     |> validate_required([:id, :inReplyTo, :name, :attributedTo, :actor])
     |> CommonValidations.validate_any_presence([:cc, :to])
     |> CommonValidations.validate_fields_match([:actor, :attributedTo])
-    |> CommonValidations.validate_actor_is_active()
+    |> CommonValidations.validate_actor_presence()
     |> CommonValidations.validate_host_match()
   end
 end
index 57d4456aa202659b31490c5604c05b029f98876f..67352f801af7430819a5968d268d4bed644a4131 100644 (file)
@@ -47,19 +47,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations do
     end)
   end
 
-  def validate_actor_is_active(cng, options \\ []) do
-    field_name = Keyword.get(options, :field_name, :actor)
-
-    cng
-    |> validate_change(field_name, fn field_name, actor ->
-      if %User{deactivated: false} = User.get_cached_by_ap_id(actor) do
-        []
-      else
-        [{field_name, "can't find user (or deactivated)"}]
-      end
-    end)
-  end
-
   def validate_object_presence(cng, options \\ []) do
     field_name = Keyword.get(options, :field_name, :object)
     allowed_types = Keyword.get(options, :allowed_types, false)
index ff889330ef00a1bda10c687ad5da1818b7c9a966..2569df7f69f11fbb08996ef086ef049122b3cc07 100644 (file)
@@ -55,7 +55,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.CreateGenericValidator do
     cng
     |> validate_required([:actor, :type, :object])
     |> validate_inclusion(:type, ["Create"])
-    |> validate_actor_is_active()
+    |> validate_actor_presence()
     |> validate_any_presence([:to, :cc])
     |> validate_actors_match(meta)
     |> validate_context_match(meta)
index d248c6aec2fb54c4a4c856b2ea2b97c5dddc67a4..694cb673052413d0d85777f2da9e5af5278e18e0 100644 (file)
@@ -114,7 +114,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do
     |> validate_required([:id, :actor, :attributedTo, :type, :context])
     |> CommonValidations.validate_any_presence([:cc, :to])
     |> CommonValidations.validate_fields_match([:actor, :attributedTo])
-    |> CommonValidations.validate_actor_is_active()
+    |> CommonValidations.validate_actor_presence()
     |> CommonValidations.validate_any_presence([:oneOf, :anyOf])
     |> CommonValidations.validate_host_match()
   end