diff options
author | lain <lain@soykaf.club> | 2020-07-03 15:54:25 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-07-03 15:54:25 +0200 |
commit | e3b5559780f798945eea59170afa9ef41bbf59b3 (patch) | |
tree | c4df2a4040e08d3c424e103b79426941427bae1d /lib | |
parent | 4a7b89e37217af4d98746bb934b8264d7a8de51d (diff) | |
download | pleroma-e3b5559780f798945eea59170afa9ef41bbf59b3.tar.gz |
AccountController: Make setting accepts_chat_messages possible.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/user.ex | 3 | ||||
-rw-r--r-- | lib/pleroma/web/api_spec/operations/account_operation.ex | 9 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/account_controller.ex | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index a4130c89f..712bc3047 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -483,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) diff --git a/lib/pleroma/web/api_spec/operations/account_operation.ex b/lib/pleroma/web/api_spec/operations/account_operation.ex index 9bde8fc0d..3c05fa55f 100644 --- a/lib/pleroma/web/api_spec/operations/account_operation.ex +++ b/lib/pleroma/web/api_spec/operations/account_operation.ex @@ -61,7 +61,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do description: "Update the user's display and preferences.", operationId: "AccountController.update_credentials", security: [%{"oAuth" => ["write:accounts"]}], - requestBody: request_body("Parameters", update_creadentials_request(), required: true), + requestBody: request_body("Parameters", update_credentials_request(), required: true), responses: %{ 200 => Operation.response("Account", "application/json", Account), 403 => Operation.response("Error", "application/json", ApiError) @@ -458,7 +458,7 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do } end - defp update_creadentials_request do + defp update_credentials_request do %Schema{ title: "AccountUpdateCredentialsRequest", description: "POST body for creating an account", @@ -492,6 +492,11 @@ defmodule Pleroma.Web.ApiSpec.AccountOperation do nullable: true, description: "Whether manual approval of follow requests is required." }, + accepts_chat_messages: %Schema{ + allOf: [BooleanLike], + nullable: true, + description: "Whether the user accepts receiving chat messages." + }, fields_attributes: %Schema{ nullable: true, oneOf: [ diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index b5008d69b..7ff767db6 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -160,7 +160,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do :show_role, :skip_thread_containment, :allow_following_move, - :discoverable + :discoverable, + :accepts_chat_messages ] |> Enum.reduce(%{}, fn key, acc -> Maps.put_if_present(acc, key, params[key], &{:ok, truthy_param?(&1)}) |