Merge branch 'develop' into support/update_oban
This commit is contained in:
commit
c255c2e4f5
50
CHANGELOG.md
50
CHANGELOG.md
|
@ -4,9 +4,6 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## [unreleased]
|
## [unreleased]
|
||||||
### Changed
|
|
||||||
- **Breaking:** BBCode and Markdown formatters will no longer return any `\n` and only use `<br/>` for newlines
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- **Breaking:** removed `with_move` parameter from notifications timeline.
|
- **Breaking:** removed `with_move` parameter from notifications timeline.
|
||||||
|
|
||||||
|
@ -21,6 +18,53 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Mastodon API: Added `/api/v1/notifications/:id/dismiss` endpoint.
|
- Mastodon API: Added `/api/v1/notifications/:id/dismiss` endpoint.
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Support pagination in conversations API
|
||||||
|
|
||||||
|
## [unreleased-patch]
|
||||||
|
|
||||||
|
## [2.0.2] - 2020-04-08
|
||||||
|
### Added
|
||||||
|
- Support for Funkwhale's `Audio` activity
|
||||||
|
- Admin API: `PATCH /api/pleroma/admin/users/:nickname/update_credentials`
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Blocked/muted users still generating push notifications
|
||||||
|
- Input textbox for bio ignoring newlines
|
||||||
|
- OTP: Inability to use PostgreSQL databases with SSL
|
||||||
|
- `user delete_activities` breaking when trying to delete already deleted posts
|
||||||
|
- Incorrect URL for Funkwhale channels
|
||||||
|
|
||||||
|
### Upgrade notes
|
||||||
|
1. Restart Pleroma
|
||||||
|
|
||||||
|
## [2.0.1] - 2020-03-15
|
||||||
|
### Security
|
||||||
|
- Static-FE: Fix remote posts not being sanitized
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- 500 errors when no `Accept` header is present if Static-FE is enabled
|
||||||
|
- Instance panel not being updated immediately due to wrong `Cache-Control` headers
|
||||||
|
- Statuses posted with BBCode/Markdown having unncessary newlines in Pleroma-FE
|
||||||
|
- OTP: Fix some settings not being migrated to in-database config properly
|
||||||
|
- No `Cache-Control` headers on attachment/media proxy requests
|
||||||
|
- Character limit enforcement being off by 1
|
||||||
|
- Mastodon Streaming API: hashtag timelines not working
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- BBCode and Markdown formatters will no longer return any `\n` and only use `<br/>` for newlines
|
||||||
|
- Mastodon API: Allow registration without email if email verification is not enabled
|
||||||
|
|
||||||
|
### Upgrade notes
|
||||||
|
#### Nginx only
|
||||||
|
1. Remove `proxy_ignore_headers Cache-Control;` and `proxy_hide_header Cache-Control;` from your config.
|
||||||
|
|
||||||
|
#### Everyone
|
||||||
|
1. Run database migrations (inside Pleroma directory):
|
||||||
|
- OTP: `./bin/pleroma_ctl migrate`
|
||||||
|
- From Source: `mix ecto.migrate`
|
||||||
|
2. Restart Pleroma
|
||||||
|
|
||||||
## [2.0.0] - 2019-03-08
|
## [2.0.0] - 2019-03-08
|
||||||
### Security
|
### Security
|
||||||
- Mastodon API: Fix being able to request enourmous amount of statuses in timelines leading to DoS. Now limited to 40 per request.
|
- Mastodon API: Fix being able to request enourmous amount of statuses in timelines leading to DoS. Now limited to 40 per request.
|
||||||
|
|
|
@ -721,7 +721,7 @@ def move(%User{} = origin, %User{} = target, local \\ true) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp fetch_activities_for_context_query(context, opts) do
|
def fetch_activities_for_context_query(context, opts) do
|
||||||
public = [Constants.as_public()]
|
public = [Constants.as_public()]
|
||||||
|
|
||||||
recipients =
|
recipients =
|
||||||
|
|
|
@ -205,16 +205,46 @@ def fix_context(object) do
|
||||||
|> Map.put("conversation", context)
|
|> Map.put("conversation", context)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp add_if_present(map, _key, nil), do: map
|
||||||
|
|
||||||
|
defp add_if_present(map, key, value) do
|
||||||
|
Map.put(map, key, value)
|
||||||
|
end
|
||||||
|
|
||||||
def fix_attachments(%{"attachment" => attachment} = object) when is_list(attachment) do
|
def fix_attachments(%{"attachment" => attachment} = object) when is_list(attachment) do
|
||||||
attachments =
|
attachments =
|
||||||
Enum.map(attachment, fn data ->
|
Enum.map(attachment, fn data ->
|
||||||
media_type = data["mediaType"] || data["mimeType"]
|
url =
|
||||||
href = data["url"] || data["href"]
|
cond do
|
||||||
url = [%{"type" => "Link", "mediaType" => media_type, "href" => href}]
|
is_list(data["url"]) -> List.first(data["url"])
|
||||||
|
is_map(data["url"]) -> data["url"]
|
||||||
|
true -> nil
|
||||||
|
end
|
||||||
|
|
||||||
data
|
media_type =
|
||||||
|> Map.put("mediaType", media_type)
|
cond do
|
||||||
|> Map.put("url", url)
|
is_map(url) && is_binary(url["mediaType"]) -> url["mediaType"]
|
||||||
|
is_binary(data["mediaType"]) -> data["mediaType"]
|
||||||
|
is_binary(data["mimeType"]) -> data["mimeType"]
|
||||||
|
true -> nil
|
||||||
|
end
|
||||||
|
|
||||||
|
href =
|
||||||
|
cond do
|
||||||
|
is_map(url) && is_binary(url["href"]) -> url["href"]
|
||||||
|
is_binary(data["url"]) -> data["url"]
|
||||||
|
is_binary(data["href"]) -> data["href"]
|
||||||
|
end
|
||||||
|
|
||||||
|
attachment_url =
|
||||||
|
%{"href" => href}
|
||||||
|
|> add_if_present("mediaType", media_type)
|
||||||
|
|> add_if_present("type", Map.get(url || %{}, "type"))
|
||||||
|
|
||||||
|
%{"url" => [attachment_url]}
|
||||||
|
|> add_if_present("mediaType", media_type)
|
||||||
|
|> add_if_present("type", data["type"])
|
||||||
|
|> add_if_present("name", data["name"])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Map.put(object, "attachment", attachments)
|
Map.put(object, "attachment", attachments)
|
||||||
|
|
|
@ -110,12 +110,11 @@ def conversation(%{assigns: %{user: user}} = conn, %{"id" => participation_id})
|
||||||
end
|
end
|
||||||
|
|
||||||
def conversation_statuses(
|
def conversation_statuses(
|
||||||
%{assigns: %{user: user}} = conn,
|
%{assigns: %{user: %{id: user_id} = user}} = conn,
|
||||||
%{"id" => participation_id} = params
|
%{"id" => participation_id} = params
|
||||||
) do
|
) do
|
||||||
with %Participation{} = participation <-
|
with %Participation{user_id: ^user_id} = participation <-
|
||||||
Participation.get(participation_id, preload: [:conversation]),
|
Participation.get(participation_id, preload: [:conversation]) do
|
||||||
true <- user.id == participation.user_id do
|
|
||||||
params =
|
params =
|
||||||
params
|
params
|
||||||
|> Map.put("blocking_user", user)
|
|> Map.put("blocking_user", user)
|
||||||
|
@ -124,7 +123,8 @@ def conversation_statuses(
|
||||||
|
|
||||||
activities =
|
activities =
|
||||||
participation.conversation.ap_id
|
participation.conversation.ap_id
|
||||||
|> ActivityPub.fetch_activities_for_context(params)
|
|> ActivityPub.fetch_activities_for_context_query(params)
|
||||||
|
|> Pleroma.Pagination.fetch_paginated(Map.put(params, "total", false))
|
||||||
|> Enum.reverse()
|
|> Enum.reverse()
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|
|
|
@ -1239,16 +1239,56 @@ test "POST /api/ap/upload_media", %{conn: conn} do
|
||||||
filename: "an_image.jpg"
|
filename: "an_image.jpg"
|
||||||
}
|
}
|
||||||
|
|
||||||
conn =
|
object =
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/ap/upload_media", %{"file" => image, "description" => desc})
|
|> post("/api/ap/upload_media", %{"file" => image, "description" => desc})
|
||||||
|
|> json_response(:created)
|
||||||
|
|
||||||
assert object = json_response(conn, :created)
|
|
||||||
assert object["name"] == desc
|
assert object["name"] == desc
|
||||||
assert object["type"] == "Document"
|
assert object["type"] == "Document"
|
||||||
assert object["actor"] == user.ap_id
|
assert object["actor"] == user.ap_id
|
||||||
|
assert [%{"href" => object_href, "mediaType" => object_mediatype}] = object["url"]
|
||||||
|
assert is_binary(object_href)
|
||||||
|
assert object_mediatype == "image/jpeg"
|
||||||
|
|
||||||
|
activity_request = %{
|
||||||
|
"@context" => "https://www.w3.org/ns/activitystreams",
|
||||||
|
"type" => "Create",
|
||||||
|
"object" => %{
|
||||||
|
"type" => "Note",
|
||||||
|
"content" => "AP C2S test, attachment",
|
||||||
|
"attachment" => [object]
|
||||||
|
},
|
||||||
|
"to" => "https://www.w3.org/ns/activitystreams#Public",
|
||||||
|
"cc" => []
|
||||||
|
}
|
||||||
|
|
||||||
|
activity_response =
|
||||||
|
conn
|
||||||
|
|> assign(:user, user)
|
||||||
|
|> post("/users/#{user.nickname}/outbox", activity_request)
|
||||||
|
|> json_response(:created)
|
||||||
|
|
||||||
|
assert activity_response["id"]
|
||||||
|
assert activity_response["object"]
|
||||||
|
assert activity_response["actor"] == user.ap_id
|
||||||
|
|
||||||
|
assert %Object{data: %{"attachment" => [attachment]}} =
|
||||||
|
Object.normalize(activity_response["object"])
|
||||||
|
|
||||||
|
assert attachment["type"] == "Document"
|
||||||
|
assert attachment["name"] == desc
|
||||||
|
|
||||||
|
assert [
|
||||||
|
%{
|
||||||
|
"href" => ^object_href,
|
||||||
|
"type" => "Link",
|
||||||
|
"mediaType" => ^object_mediatype
|
||||||
|
}
|
||||||
|
] = attachment["url"]
|
||||||
|
|
||||||
|
# Fails if unauthenticated
|
||||||
conn
|
conn
|
||||||
|> post("/api/ap/upload_media", %{"file" => image, "description" => desc})
|
|> post("/api/ap/upload_media", %{"file" => image, "description" => desc})
|
||||||
|> json_response(403)
|
|> json_response(403)
|
||||||
|
|
|
@ -1230,19 +1230,13 @@ test "it remaps video URLs as attachments if necessary" do
|
||||||
attachment = %{
|
attachment = %{
|
||||||
"type" => "Link",
|
"type" => "Link",
|
||||||
"mediaType" => "video/mp4",
|
"mediaType" => "video/mp4",
|
||||||
"href" =>
|
|
||||||
"https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4",
|
|
||||||
"mimeType" => "video/mp4",
|
|
||||||
"size" => 5_015_880,
|
|
||||||
"url" => [
|
"url" => [
|
||||||
%{
|
%{
|
||||||
"href" =>
|
"href" =>
|
||||||
"https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4",
|
"https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4",
|
||||||
"mediaType" => "video/mp4",
|
"mediaType" => "video/mp4"
|
||||||
"type" => "Link"
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"width" => 480
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert object.data["url"] ==
|
assert object.data["url"] ==
|
||||||
|
@ -2063,11 +2057,7 @@ test "returns modified object when attachment is map" do
|
||||||
%{
|
%{
|
||||||
"mediaType" => "video/mp4",
|
"mediaType" => "video/mp4",
|
||||||
"url" => [
|
"url" => [
|
||||||
%{
|
%{"href" => "https://peertube.moe/stat-480.mp4", "mediaType" => "video/mp4"}
|
||||||
"href" => "https://peertube.moe/stat-480.mp4",
|
|
||||||
"mediaType" => "video/mp4",
|
|
||||||
"type" => "Link"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -2085,23 +2075,13 @@ test "returns modified object when attachment is list" do
|
||||||
%{
|
%{
|
||||||
"mediaType" => "video/mp4",
|
"mediaType" => "video/mp4",
|
||||||
"url" => [
|
"url" => [
|
||||||
%{
|
%{"href" => "https://pe.er/stat-480.mp4", "mediaType" => "video/mp4"}
|
||||||
"href" => "https://pe.er/stat-480.mp4",
|
|
||||||
"mediaType" => "video/mp4",
|
|
||||||
"type" => "Link"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
"href" => "https://pe.er/stat-480.mp4",
|
|
||||||
"mediaType" => "video/mp4",
|
"mediaType" => "video/mp4",
|
||||||
"mimeType" => "video/mp4",
|
|
||||||
"url" => [
|
"url" => [
|
||||||
%{
|
%{"href" => "https://pe.er/stat-480.mp4", "mediaType" => "video/mp4"}
|
||||||
"href" => "https://pe.er/stat-480.mp4",
|
|
||||||
"mediaType" => "video/mp4",
|
|
||||||
"type" => "Link"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -169,6 +169,23 @@ test "/api/v1/pleroma/conversations/:id/statuses" do
|
||||||
id_one = activity.id
|
id_one = activity.id
|
||||||
id_two = activity_two.id
|
id_two = activity_two.id
|
||||||
assert [%{"id" => ^id_one}, %{"id" => ^id_two}] = result
|
assert [%{"id" => ^id_one}, %{"id" => ^id_two}] = result
|
||||||
|
|
||||||
|
{:ok, %{id: id_three}} =
|
||||||
|
CommonAPI.post(other_user, %{
|
||||||
|
"status" => "Bye!",
|
||||||
|
"in_reply_to_status_id" => activity.id,
|
||||||
|
"in_reply_to_conversation_id" => participation.id
|
||||||
|
})
|
||||||
|
|
||||||
|
assert [%{"id" => ^id_two}, %{"id" => ^id_three}] =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/pleroma/conversations/#{participation.id}/statuses?limit=2")
|
||||||
|
|> json_response(:ok)
|
||||||
|
|
||||||
|
assert [%{"id" => ^id_three}] =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/pleroma/conversations/#{participation.id}/statuses?min_id=#{id_two}")
|
||||||
|
|> json_response(:ok)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "PATCH /api/v1/pleroma/conversations/:id" do
|
test "PATCH /api/v1/pleroma/conversations/:id" do
|
||||||
|
|
Loading…
Reference in New Issue