1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Workers.BackgroundWorker do
8 use Pleroma.Workers.WorkerHelper, queue: "background"
12 def perform(%Job{args: %{"op" => "user_activation", "user_id" => user_id, "status" => status}}) do
13 user = User.get_cached_by_id(user_id)
14 User.perform(:set_activation_async, user, status)
17 def perform(%Job{args: %{"op" => "delete_user", "user_id" => user_id}}) do
18 user = User.get_cached_by_id(user_id)
19 User.perform(:delete, user)
22 def perform(%Job{args: %{"op" => "force_password_reset", "user_id" => user_id}}) do
23 user = User.get_cached_by_id(user_id)
24 User.perform(:force_password_reset, user)
27 def perform(%Job{args: %{"op" => op, "user_id" => user_id, "identifiers" => identifiers}})
28 when op in ["blocks_import", "follow_import", "mutes_import"] do
29 user = User.get_cached_by_id(user_id)
30 {:ok, User.Import.perform(String.to_atom(op), user, identifiers)}
34 args: %{"op" => "move_following", "origin_id" => origin_id, "target_id" => target_id}
36 origin = User.get_cached_by_id(origin_id)
37 target = User.get_cached_by_id(target_id)
39 Pleroma.FollowingRelationship.move_following(origin, target)