Added support for exclude_types, limit, and min_id in Mastodon

notifications.

Unify Mastodon-compatible pagination logic.
This commit is contained in:
eugenijm 2019-03-18 04:32:23 +03:00
commit 1588688a11
6 changed files with 204 additions and 58 deletions

View file

@ -22,6 +22,10 @@ defmodule Pleroma.Activity do
"Like" => "favourite"
}
@mastodon_to_ap_notification_types for {k, v} <- @mastodon_notification_types,
into: %{},
do: {v, k}
schema "activities" do
field(:data, :map)
field(:local, :boolean, default: true)
@ -126,6 +130,10 @@ defmodule Pleroma.Activity do
def mastodon_notification_type(%Activity{}), do: nil
def from_mastodon_notification_type(type) do
Map.get(@mastodon_to_ap_notification_types, type)
end
def all_by_actor_and_id(actor, status_ids \\ [])
def all_by_actor_and_id(_actor, []), do: []