Move these to pleroma namespace in Mastodon API

This commit is contained in:
Mark Felder 2019-07-12 11:25:58 -05:00
parent b6567c9f4e
commit 360e4cdaa2
4 changed files with 17 additions and 18 deletions

View File

@ -46,14 +46,6 @@ Has these additional fields under the `pleroma` object:
- `settings_store`: A generic map of settings for frontends. Opaque to the backend. Only returned in `verify_credentials` and `update_credentials`
- `chat_token`: The token needed for Pleroma chat. Only returned in `verify_credentials`
### Extensions for PleromaFE
These endpoints added for controlling PleromaFE features over the Mastodon API
- PATCH `/api/v1/accounts/update_avatar`: Set/clear user avatar image
- PATCH `/api/v1/accounts/update_banner`: Set/clear user banner image
- PATCH `/api/v1/accounts/update_background`: Set/clear user background image
### Source
Has these additional fields under the `pleroma` object:

View File

@ -238,6 +238,13 @@ See [Admin-API](Admin-API.md)
]
```
## `/api/v1/pleroma/accounts/update_*`
### Set and clear account avatar, banner, and background
- PATCH `/api/v1/pleroma/accounts/update_avatar`: Set/clear user avatar image
- PATCH `/api/v1/pleroma/accounts/update_banner`: Set/clear user banner image
- PATCH `/api/v1/pleroma/accounts/update_background`: Set/clear user background image
## `/api/v1/pleroma/mascot`
### Gets user mascot image
* Method `GET`

View File

@ -322,10 +322,6 @@ defmodule Pleroma.Web.Router do
patch("/accounts/update_credentials", MastodonAPIController, :update_credentials)
patch("/accounts/update_avatar", MastodonAPIController, :update_avatar)
patch("/accounts/update_banner", MastodonAPIController, :update_banner)
patch("/accounts/update_background", MastodonAPIController, :update_background)
post("/statuses", MastodonAPIController, :post_status)
delete("/statuses/:id", MastodonAPIController, :delete_status)
@ -360,6 +356,10 @@ defmodule Pleroma.Web.Router do
put("/filters/:id", MastodonAPIController, :update_filter)
delete("/filters/:id", MastodonAPIController, :delete_filter)
patch("/pleroma/accounts/update_avatar", MastodonAPIController, :update_avatar)
patch("/pleroma/accounts/update_banner", MastodonAPIController, :update_banner)
patch("/pleroma/accounts/update_background", MastodonAPIController, :update_background)
get("/pleroma/mascot", MastodonAPIController, :get_mascot)
put("/pleroma/mascot", MastodonAPIController, :set_mascot)

View File

@ -593,7 +593,7 @@ test "user avatar can be set", %{conn: conn} do
conn =
conn
|> assign(:user, user)
|> patch("/api/v1/accounts/update_avatar", %{img: avatar_image})
|> patch("/api/v1/pleroma/accounts/update_avatar", %{img: avatar_image})
user = refresh_record(user)
@ -618,7 +618,7 @@ test "user avatar can be reset", %{conn: conn} do
conn =
conn
|> assign(:user, user)
|> patch("/api/v1/accounts/update_avatar", %{img: ""})
|> patch("/api/v1/pleroma/accounts/update_avatar", %{img: ""})
user = User.get_cached_by_id(user.id)
@ -633,7 +633,7 @@ test "can set profile banner", %{conn: conn} do
conn =
conn
|> assign(:user, user)
|> patch("/api/v1/accounts/update_banner", %{"banner" => @image})
|> patch("/api/v1/pleroma/accounts/update_banner", %{"banner" => @image})
user = refresh_record(user)
assert user.info.banner["type"] == "Image"
@ -647,7 +647,7 @@ test "can reset profile banner", %{conn: conn} do
conn =
conn
|> assign(:user, user)
|> patch("/api/v1/accounts/update_banner", %{"banner" => ""})
|> patch("/api/v1/pleroma/accounts/update_banner", %{"banner" => ""})
user = refresh_record(user)
assert user.info.banner == %{}
@ -661,7 +661,7 @@ test "background image can be set", %{conn: conn} do
conn =
conn
|> assign(:user, user)
|> patch("/api/v1/accounts/update_background", %{"img" => @image})
|> patch("/api/v1/pleroma/accounts/update_background", %{"img" => @image})
user = refresh_record(user)
assert user.info.background["type"] == "Image"
@ -674,7 +674,7 @@ test "background image can be reset", %{conn: conn} do
conn =
conn
|> assign(:user, user)
|> patch("/api/v1/accounts/update_background", %{"img" => ""})
|> patch("/api/v1/pleroma/accounts/update_background", %{"img" => ""})
user = refresh_record(user)
assert user.info.background == %{}