First
[anni] / lib / pleroma / workers / mute_expire_worker.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Workers.MuteExpireWorker do
6   use Pleroma.Workers.WorkerHelper, queue: "mute_expire"
7
8   @impl Oban.Worker
9   def perform(%Job{args: %{"op" => "unmute_user", "muter_id" => muter_id, "mutee_id" => mutee_id}}) do
10     Pleroma.User.unmute(muter_id, mutee_id)
11     :ok
12   end
13
14   def perform(%Job{
15         args: %{"op" => "unmute_conversation", "user_id" => user_id, "activity_id" => activity_id}
16       }) do
17     Pleroma.Web.CommonAPI.remove_mute(user_id, activity_id)
18     :ok
19   end
20
21   @impl Oban.Worker
22   def timeout(_job), do: :timer.seconds(5)
23 end