Browse Source

Merge branch 'fix/add-default-scope-mastoapi' into 'develop'

Add default_scope to /api/v1/update_credentials

See merge request pleroma/pleroma!1100
tags/v1.1.4
rinpatch 5 years ago
parent
commit
0fd176b990
3 changed files with 14 additions and 0 deletions
  1. +1
    -0
      docs/api/differences_in_mastoapi_responses.md
  2. +1
    -0
      lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
  3. +12
    -0
      test/web/mastodon_api/mastodon_api_controller_test.exs

+ 1
- 0
docs/api/differences_in_mastoapi_responses.md View File

@@ -79,3 +79,4 @@ Additional parameters can be added to the JSON body/Form data:
- `hide_follows` - if true, user's follows will be hidden
- `hide_favorites` - if true, user's favorites timeline will be hidden
- `show_role` - if true, user's role (e.g admin, moderator) will be exposed to anyone in the API
- `default_scope` - the scope returned under `privacy` key in Source subentity

+ 1
- 0
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex View File

@@ -103,6 +103,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
{:ok, ControllerHelper.truthy_param?(value)}
end)
end)
|> add_if_present(params, "default_scope", :default_scope)
|> add_if_present(params, "header", :banner, fn value ->
with %Plug.Upload{} <- value,
{:ok, object} <- ActivityPub.upload(value, type: :banner) do


+ 12
- 0
test/web/mastodon_api/mastodon_api_controller_test.exs View File

@@ -2214,6 +2214,18 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert user["locked"] == true
end

test "updates the user's default scope", %{conn: conn} do
user = insert(:user)

conn =
conn
|> assign(:user, user)
|> patch("/api/v1/accounts/update_credentials", %{default_scope: "cofe"})

assert user = json_response(conn, 200)
assert user["source"]["privacy"] == "cofe"
end

test "updates the user's hide_followers status", %{conn: conn} do
user = insert(:user)



Loading…
Cancel
Save