From 43d0b7bf7ae0e44366a56a6e0b9172b0caedd14a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 20 Sep 2018 16:10:46 +0200 Subject: [PATCH 1/5] [Pleroma.Web.MastodonAPI.StatusView] add replies_count --- lib/pleroma/web/mastodon_api/views/status_view.ex | 2 ++ test/web/mastodon_api/status_view_test.exs | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 284df837a..ffc105196 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -63,6 +63,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do content: reblogged[:content], created_at: created_at, reblogs_count: 0, + replies_count: 0, favourites_count: 0, reblogged: false, favourited: false, @@ -132,6 +133,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do content: render_content(object), created_at: created_at, reblogs_count: announcement_count, + replies_count: 0, favourites_count: like_count, reblogged: !!repeated, favourited: !!favorited, diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index b3b6c5851..b9c019206 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -28,6 +28,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do content: HtmlSanitizeEx.basic_html(note.data["object"]["content"]), created_at: created_at, reblogs_count: 0, + replies_count: 0, favourites_count: 0, reblogged: false, favourited: false, From a8eaecadee1807af89e2917f4c1981e7981ad908 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 20 Sep 2018 16:22:31 +0200 Subject: [PATCH 2/5] [Pleroma.Web.MastodonAPI.AccountView]: relationship.json: fake endorsed value (false) --- lib/pleroma/web/mastodon_api/views/account_view.ex | 3 ++- test/web/mastodon_api/account_view_test.exs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index 7c92c991f..3c8f93486 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -79,7 +79,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do muting_notifications: false, requested: false, domain_blocking: false, - showing_reblogs: false + showing_reblogs: false, + endorsed: false } end diff --git a/test/web/mastodon_api/account_view_test.exs b/test/web/mastodon_api/account_view_test.exs index e1e07fbcd..dc52b92bc 100644 --- a/test/web/mastodon_api/account_view_test.exs +++ b/test/web/mastodon_api/account_view_test.exs @@ -126,7 +126,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do muting_notifications: false, requested: false, domain_blocking: false, - showing_reblogs: false + showing_reblogs: false, + endorsed: false } assert expected == AccountView.render("relationship.json", %{user: user, target: other_user}) From 33a1e92584d9a7e4819677fd2e0754ef6edc418a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 20 Sep 2018 16:25:07 +0200 Subject: [PATCH 3/5] [Pleroma.Web.Router]: Fake /api/v1/endorsements --- lib/pleroma/web/router.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index d324efb7e..646e9e5cb 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -172,6 +172,8 @@ defmodule Pleroma.Web.Router do delete("/filters/:id", MastodonAPIController, :delete_filter) get("/suggestions", MastodonAPIController, :suggestions) + + get("/endorsements", MastodonAPIController, :empty_array) end scope "/api/web", Pleroma.Web.MastodonAPI do From f74725df41be8081e40d4c3ec5a3ba7ac27edf21 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 20 Sep 2018 16:37:18 +0200 Subject: [PATCH 4/5] [Pleroma.Web.MastodonAPI.MastodonAPIController]: Remove unused variables --- .../web/mastodon_api/mastodon_api_controller.ex | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 031fc1a5d..6054abc0d 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -441,7 +441,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do new_data = %{object.data | "name" => description} change = Object.change(object, %{data: new_data}) - {:ok, media_obj} = Repo.update(change) + {:ok, _} = Repo.update(change) data = new_data @@ -1077,7 +1077,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do end end - def get_filters(%{assigns: %{user: user}} = conn, params) do + def get_filters(%{assigns: %{user: user}} = conn, _) do filters = Pleroma.Filter.get_filters(user) res = FilterView.render("filters.json", filters: filters) json(conn, res) @@ -1101,7 +1101,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do json(conn, res) end - def get_filter(%{assigns: %{user: user}} = conn, %{"id" => filter_id} = params) do + def get_filter(%{assigns: %{user: user}} = conn, %{"id" => filter_id}) do filter = Pleroma.Filter.get(filter_id, user) res = FilterView.render("filter.json", filter: filter) json(conn, res) @@ -1126,13 +1126,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do json(conn, res) end - def delete_filter(%{assigns: %{user: user}} = conn, %{"id" => filter_id} = params) do + def delete_filter(%{assigns: %{user: user}} = conn, %{"id" => filter_id}) do query = %Pleroma.Filter{ user_id: user.id, filter_id: filter_id } - {:ok, response} = Pleroma.Filter.delete(query) + {:ok, _} = Pleroma.Filter.delete(query) json(conn, %{}) end From 40c51f118f463127b2538e04fe3b29f90f89055d Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 20 Sep 2018 16:48:12 +0200 Subject: [PATCH 5/5] [Pleroma.Web.MastodonAPI.MastodonAPIController]: Bump mastodon_api_level to 2.5.0 --- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 6054abc0d..3d292182d 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -125,7 +125,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do end @instance Application.get_env(:pleroma, :instance) - @mastodon_api_level "2.4.3" + @mastodon_api_level "2.5.0" def masto_instance(conn, _params) do response = %{