diff options
author | lain <lain@soykaf.club> | 2020-06-20 09:57:12 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-06-20 09:57:12 +0000 |
commit | 31761340fe7246ea9b57c0d0f7e61df85aa2af85 (patch) | |
tree | acbb064a89eb90b90fdad7fb6150cebe6477f1a2 /lib | |
parent | 50d0c580038f8ae3187f299396f342df4e49e17b (diff) | |
parent | ac0344dd24d520ab61e835b9caea97529f4c1dad (diff) | |
download | pleroma-31761340fe7246ea9b57c0d0f7e61df85aa2af85.tar.gz pleroma-31761340fe7246ea9b57c0d0f7e61df85aa2af85.zip |
Merge branch 'feature/support-bot-field-in-update-credentials' into 'develop'
Support 'bot' field in account update_credentials
Closes #1600 and #1467
See merge request pleroma/pleroma!2662
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/user.ex | 1 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/account_controller.ex | 3 | ||||
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/account_view.ex | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index f0ccc7c79..ae4f96aac 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -465,6 +465,7 @@ defmodule Pleroma.User do |> validate_format(:nickname, local_nickname_regex()) |> validate_length(:bio, max: bio_limit) |> validate_length(:name, min: 1, max: name_limit) + |> validate_inclusion(:actor_type, ["Person", "Service"]) |> put_fields() |> put_emoji() |> put_change_if_present(:bio, &{:ok, parse_bio(&1, struct)}) diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index c38c2b895..adbbac624 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -177,6 +177,9 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do |> Maps.put_if_present(:pleroma_settings_store, params[:pleroma_settings_store]) |> Maps.put_if_present(:default_scope, params[:default_scope]) |> Maps.put_if_present(:default_scope, params["source"]["privacy"]) + |> Maps.put_if_present(:actor_type, params[:bot], fn bot -> + if bot, do: {:ok, "Service"}, else: {:ok, "Person"} + end) |> Maps.put_if_present(:actor_type, params[:actor_type]) changeset = User.update_changeset(user, user_params) diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index 68beb69b8..6c40b8ccd 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -179,7 +179,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do 0 end - bot = user.actor_type in ["Application", "Service"] + bot = user.actor_type == "Service" emojis = Enum.map(user.emoji, fn {shortcode, raw_url} -> |