X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fuser%2Finfo.ex;h=ad9fe1bbeb12c92662350040abc272a60e31dfe8;hb=968d7490b689ba501a64f350841dc8f9b33b5244;hp=a5ce6010fecf1c5ccc7610a656bf7525c15f4c35;hpb=c443c9bd72b04b8a24d904bc20fde0d4ffca71d7;p=akkoma diff --git a/lib/pleroma/user/info.ex b/lib/pleroma/user/info.ex index a5ce6010f..ad9fe1bbe 100644 --- a/lib/pleroma/user/info.ex +++ b/lib/pleroma/user/info.ex @@ -4,11 +4,13 @@ defmodule Pleroma.User.Info do embedded_schema do field(:banner, :map, default: %{}) - field(:background, :string, default: nil) + field(:background, :map, default: %{}) field(:source_data, :map, default: %{}) field(:note_count, :integer, default: 0) field(:follower_count, :integer, default: 0) field(:locked, :boolean, default: false) + field(:confirmation_pending, :boolean, default: false) + field(:confirmation_token, :string, default: nil) field(:default_scope, :string, default: "public") field(:blocks, {:array, :string}, default: []) field(:domain_blocks, {:array, :string}, default: []) @@ -23,7 +25,16 @@ defmodule Pleroma.User.Info do field(:uri, :string, default: nil) field(:topic, :string, default: nil) field(:hub, :string, default: nil) - # topic, subject, salmon, subscribe_address, uri + field(:salmon, :string, default: nil) + field(:hide_network, :boolean, default: false) + + # Found in the wild + # ap_id -> Where is this used? + # bio -> Where is this used? + # avatar -> Where is this used? + # fqn -> Where is this used? + # host -> Where is this used? + # subject _> Where is this used? end def set_activation_status(info, deactivated) do @@ -104,7 +115,8 @@ defmodule Pleroma.User.Info do :magic_key, :uri, :hub, - :topic + :topic, + :salmon ]) end @@ -124,10 +136,47 @@ defmodule Pleroma.User.Info do |> cast(params, [ :locked, :no_rich_text, - :default_scope + :default_scope, + :banner, + :hide_network, + :background + ]) + end + + def confirmation_changeset(info, :confirmed) do + confirmation_changeset(info, %{ + confirmation_pending: false, + confirmation_token: nil + }) + end + + def confirmation_changeset(info, :unconfirmed) do + confirmation_changeset(info, %{ + confirmation_pending: true, + confirmation_token: :crypto.strong_rand_bytes(32) |> Base.url_encode64() + }) + end + + def confirmation_changeset(info, params) do + cast(info, params, [:confirmation_pending, :confirmation_token]) + end + + def mastodon_profile_update(info, params) do + info + |> cast(params, [ + :locked, + :banner ]) end + def mastodon_settings_update(info, settings) do + params = %{settings: settings} + + info + |> cast(params, [:settings]) + |> validate_required([:settings]) + end + def set_source_data(info, source_data) do params = %{source_data: source_data}