Make auth tokens usable once and expire them.
[akkoma] / lib / pleroma / activity.ex
index 40e14005b07d4d50ed64ea112c041924058af4a4..f226c4c5f351d797a9eac90bc835645c230c10bd 100644 (file)
@@ -15,9 +15,19 @@ defmodule Pleroma.Activity do
       where: fragment("(?)->>'id' = ?", activity.data, ^to_string(ap_id)))
   end
 
+  # Wrong name, only returns create activities
+  def all_by_object_ap_id_q(ap_id) do
+    from activity in Activity,
+      where: fragment("(?)->'object'->>'id' = ?", activity.data, ^to_string(ap_id))
+  end
+
+  def all_non_create_by_object_ap_id_q(ap_id) do
+    from activity in Activity,
+      where: fragment("(?)->>'object' = ?", activity.data, ^to_string(ap_id))
+  end
+
   def all_by_object_ap_id(ap_id) do
-    Repo.all(from activity in Activity,
-      where: fragment("(?)->'object'->>'id' = ?", activity.data, ^to_string(ap_id)))
+    Repo.all(all_by_object_ap_id_q(ap_id))
   end
 
   def get_create_activity_by_object_ap_id(ap_id) do