user_enabled_plug.ex 440 Bytes
Newer Older
1
# Pleroma: A lightweight social networking server
kaniini's avatar
kaniini committed
2
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3
4
# SPDX-License-Identifier: AGPL-3.0-only

lain's avatar
lain committed
5
6
7
8
9
10
11
12
defmodule Pleroma.Plugs.UserEnabledPlug do
  import Plug.Conn
  alias Pleroma.User

  def init(options) do
    options
  end

13
  def call(%{assigns: %{user: %User{deactivated: true}}} = conn, _) do
lain's avatar
lain committed
14
15
16
17
18
19
20
21
    conn
    |> assign(:user, nil)
  end

  def call(conn, _) do
    conn
  end
end