mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-05-17 01:02:38 +00:00
Fix the timeline of users with a nil
pinned_objects field.
This commit is contained in:
parent
c97f99ccf2
commit
ca87b60fa8
|
@ -641,7 +641,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
|> Map.put(:type, ["Create", "Announce"])
|
||||
|> Map.put(:user, reading_user)
|
||||
|> Map.put(:actor_id, user.ap_id)
|
||||
|> Map.put(:pinned_object_ids, Map.keys(user.pinned_objects))
|
||||
|> Map.put(:pinned_object_ids, Map.keys(user.pinned_objects || %{}))
|
||||
|
||||
params =
|
||||
if User.blocks?(reading_user, user) do
|
||||
|
|
|
@ -267,6 +267,17 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
describe "user timelines" do
|
||||
setup do: oauth_access(["read:statuses"])
|
||||
|
||||
test "works with a user who has an empty pinned objects field", %{conn: conn} do
|
||||
user = insert(:user, pinned_objects: nil)
|
||||
|
||||
assert resp =
|
||||
conn
|
||||
|> get("/api/v1/accounts/#{user.id}/statuses")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert [] == resp
|
||||
end
|
||||
|
||||
test "works with announces that are just addressed to public", %{conn: conn} do
|
||||
user = insert(:user, ap_id: "https://honktest/u/test", local: false)
|
||||
other_user = insert(:user)
|
||||
|
|
Loading…
Reference in a new issue