Test FlakeID old id compat & Ecto type
[akkoma] / lib / pleroma / activity.ex
index a14d1e8c6ddadb2638160bafa41f9890e611d4ba..d907791b57f4fda10529ea0597db39edff73a5c2 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Activity do
@@ -8,6 +8,7 @@ defmodule Pleroma.Activity do
   import Ecto.Query
 
   @type t :: %__MODULE__{}
+  @primary_key {:id, Pleroma.FlakeId, autogenerate: true}
 
   # https://github.com/tootsuite/mastodon/blob/master/app/models/notification.rb#L19
   @mastodon_notification_types %{
@@ -36,6 +37,10 @@ defmodule Pleroma.Activity do
     )
   end
 
+  def get_by_id(id) do
+    Repo.get(Activity, id)
+  end
+
   # TODO:
   # Go through these and fix them everywhere.
   # Wrong name, only returns create activities