X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fpush%2Fpush.ex;h=6459d4543e99f7e9000b995ad339e9670e62ea06;hb=922abcda61298a7bca48894cb9a51a52fdeab1ed;hp=35e14c243d984283e1c6eadd57f4e2c3810b5137;hpb=331396cbcdabe9dbfe0b84ec299a642385093605;p=akkoma diff --git a/lib/pleroma/web/push/push.ex b/lib/pleroma/web/push/push.ex index 35e14c243..6459d4543 100644 --- a/lib/pleroma/web/push/push.ex +++ b/lib/pleroma/web/push/push.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.Push do use GenServer @@ -32,7 +36,7 @@ defmodule Pleroma.Web.Push do end def init(:ok) do - if enabled() do + if !enabled() do Logger.warn(""" VAPID key pair is not found. If you wish to enabled web push, please run @@ -54,7 +58,7 @@ defmodule Pleroma.Web.Push do when type in @types do actor = User.get_cached_by_ap_id(notification.activity.data["actor"]) - type = format_type(notification) + type = Pleroma.Activity.mastodon_notification_type(notification.activity) Subscription |> where(user_id: ^user_id) @@ -114,16 +118,6 @@ defmodule Pleroma.Web.Push do {:noreply, state} end - # https://github.com/tootsuite/mastodon/blob/master/app/models/notification.rb#L19 - defp format_type(%{activity: %{data: %{"type" => type}}}) do - case type do - "Create" -> "mention" - "Follow" -> "follow" - "Announce" -> "reblog" - "Like" -> "favourite" - end - end - defp format_title(%{activity: %{data: %{"type" => type}}}) do case type do "Create" -> "New Mention"