Merge branch 'develop' into feature/moderation-log-filters
[akkoma] / lib / pleroma / workers / subscriber_worker.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Workers.SubscriberWorker do
6 alias Pleroma.Repo
7 alias Pleroma.Web.Federator
8 alias Pleroma.Web.Websub
9
10 use Pleroma.Workers.WorkerHelper, queue: "federator_outgoing"
11
12 @impl Oban.Worker
13 def perform(%{"op" => "refresh_subscriptions"}, _job) do
14 Federator.perform(:refresh_subscriptions)
15 end
16
17 def perform(%{"op" => "request_subscription", "websub_id" => websub_id}, _job) do
18 websub = Repo.get(Websub.WebsubClientSubscription, websub_id)
19 Federator.perform(:request_subscription, websub)
20 end
21
22 def perform(%{"op" => "verify_websub", "websub_id" => websub_id}, _job) do
23 websub = Repo.get(Websub.WebsubServerSubscription, websub_id)
24 Federator.perform(:verify_websub, websub)
25 end
26 end