[glitchAPI] Update bookmarks migration, mix format
This commit is contained in:
parent
5b4eccf9e7
commit
622e5c83f6
|
@ -1,11 +1,9 @@
|
||||||
defmodule Pleroma.Repo.Migrations.AddBookmarkssToUsers do
|
defmodule Pleroma.Repo.Migrations.AddBookmarksToUsers do
|
||||||
use Ecto.Migration
|
use Ecto.Migration
|
||||||
|
|
||||||
def change do
|
def change do
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
add :bookmarks, {:array, :string}
|
add :bookmarks, {:array, :string}, null: false, default: []
|
||||||
end
|
end
|
||||||
|
|
||||||
create index(:users, [:bookmarks], using: :gin)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1438,18 +1438,21 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
||||||
"status" => "heweoo!"
|
"status" => "heweoo!"
|
||||||
})
|
})
|
||||||
|
|
||||||
response = build_conn()
|
response =
|
||||||
|
build_conn()
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/v1/statuses/#{activity.id}/bookmark")
|
|> post("/api/v1/statuses/#{activity.id}/bookmark")
|
||||||
|
|
||||||
bookmarks = build_conn()
|
bookmarks =
|
||||||
|
build_conn()
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> get("/api/v1/bookmarks")
|
|> get("/api/v1/bookmarks")
|
||||||
|
|
||||||
assert [json_response(response, 200)] == json_response(bookmarks, 200)
|
assert [json_response(response, 200)] == json_response(bookmarks, 200)
|
||||||
assert json_response(response, 200)["bookmarked"] == true
|
assert json_response(response, 200)["bookmarked"] == true
|
||||||
|
|
||||||
response2 = build_conn()
|
response2 =
|
||||||
|
build_conn()
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/v1/statuses/#{activity.id}/unbookmark")
|
|> post("/api/v1/statuses/#{activity.id}/unbookmark")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue