1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.User.NotificationSetting do
13 field(:block_from_strangers, :boolean, default: false)
14 field(:hide_notification_contents, :boolean, default: false)
17 def changeset(schema, params) do
19 |> cast(prepare_attrs(params), [
20 :block_from_strangers,
21 :hide_notification_contents
25 defp prepare_attrs(params) do
26 Enum.reduce(params, %{}, fn
27 {k, v}, acc when is_binary(v) ->
28 Map.put(acc, k, String.downcase(v))