diff options
author | lain <lain@soykaf.club> | 2020-07-10 10:37:42 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-07-10 10:37:42 +0000 |
commit | fba1ee7d7b04730c33cadb036f59e8d7c90a93b0 (patch) | |
tree | 32b20b5a0ec3f5c8d44f1157087868adfaa549b0 /lib/pleroma/user.ex | |
parent | 8aa7143f464562ca2a0572087c526f26d1a3b7ef (diff) | |
parent | b39eb6ecc573c310801fe49f35d92246ddcb6226 (diff) | |
download | pleroma-fba1ee7d7b04730c33cadb036f59e8d7c90a93b0.tar.gz |
Merge branch 'chat-federation-information' into 'develop'
Add an `accepts_chat_messages` to user, expose in api and federation
See merge request pleroma/pleroma!2716
Diffstat (limited to 'lib/pleroma/user.ex')
-rw-r--r-- | lib/pleroma/user.ex | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 0078f9831..b9989f901 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -138,6 +138,7 @@ defmodule Pleroma.User do field(:also_known_as, {:array, :string}, default: []) field(:inbox, :string) field(:shared_inbox, :string) + field(:accepts_chat_messages, :boolean, default: nil) embeds_one( :notification_settings, @@ -436,7 +437,8 @@ defmodule Pleroma.User do :discoverable, :invisible, :actor_type, - :also_known_as + :also_known_as, + :accepts_chat_messages ] ) |> validate_required([:name, :ap_id]) @@ -481,7 +483,8 @@ defmodule Pleroma.User do :pleroma_settings_store, :discoverable, :actor_type, - :also_known_as + :also_known_as, + :accepts_chat_messages ] ) |> unique_constraint(:nickname) @@ -620,6 +623,7 @@ defmodule Pleroma.User do def register_changeset(struct, params \\ %{}, opts \\ []) do bio_limit = Config.get([:instance, :user_bio_length], 5000) name_limit = Config.get([:instance, :user_name_length], 100) + params = Map.put_new(params, :accepts_chat_messages, true) need_confirmation? = if is_nil(opts[:need_confirmation]) do @@ -638,7 +642,8 @@ defmodule Pleroma.User do :nickname, :password, :password_confirmation, - :emoji + :emoji, + :accepts_chat_messages ]) |> validate_required([:name, :nickname, :password, :password_confirmation]) |> validate_confirmation(:password) |