X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fuser%2Finfo.ex;h=a3785447c39164876ed9af74ec2551bbc44ed0e4;hb=a3003364598b42849e384a216948dad810481f51;hp=4e2c5472d3789375de4a2fddda61952efd857101;hpb=48b95a9b954b6d9e1b6f98097b35fcca4172c8a0;p=akkoma diff --git a/lib/pleroma/user/info.ex b/lib/pleroma/user/info.ex index 4e2c5472d..a3785447c 100644 --- a/lib/pleroma/user/info.ex +++ b/lib/pleroma/user/info.ex @@ -4,7 +4,7 @@ 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) @@ -16,13 +16,23 @@ defmodule Pleroma.User.Info do field(:no_rich_text, :boolean, default: false) field(:ap_enabled, :boolean, default: false) field(:is_moderator, :boolean, default: false) + field(:is_admin, :boolean, default: false) field(:keys, :string, default: nil) field(:settings, :map, default: nil) field(:magic_key, :string, default: nil) 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 @@ -103,7 +113,8 @@ defmodule Pleroma.User.Info do :magic_key, :uri, :hub, - :topic + :topic, + :salmon ]) end @@ -123,10 +134,29 @@ defmodule Pleroma.User.Info do |> cast(params, [ :locked, :no_rich_text, - :default_scope + :default_scope, + :banner, + :hide_network, + :background ]) 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} @@ -134,4 +164,12 @@ defmodule Pleroma.User.Info do |> cast(params, [:source_data]) |> validate_required([:source_data]) end + + def admin_api_update(info, params) do + info + |> cast(params, [ + :is_moderator, + :is_admin + ]) + end end