diff options
Diffstat (limited to 'lib')
5 files changed, 13 insertions, 14 deletions
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index e5d4245c4..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 = %{ @@ -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 @@ -1189,8 +1189,4 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do json(conn, []) end end - - def filters(conn, _) do - json(conn, []) - end end 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/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 8f6c4b062..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, @@ -154,7 +156,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do def render("attachment.json", %{attachment: attachment}) do [attachment_url | _] = attachment["url"] - media_type = attachment_url["mediaType"] || attachment_url["mimeType"] + media_type = attachment_url["mediaType"] || attachment_url["mimeType"] || "image" href = attachment_url["href"] type = diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 43e301034..ddfaa8c42 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -173,7 +173,7 @@ defmodule Pleroma.Web.Router do get("/suggestions", MastodonAPIController, :suggestions) - get("/filters", MastodonAPIController, :filters) + get("/endorsements", MastodonAPIController, :empty_array) end scope "/api/web", Pleroma.Web.MastodonAPI do diff --git a/lib/pleroma/web/twitter_api/representers/object_representer.ex b/lib/pleroma/web/twitter_api/representers/object_representer.ex index 6aa794a59..d5291a397 100644 --- a/lib/pleroma/web/twitter_api/representers/object_representer.ex +++ b/lib/pleroma/web/twitter_api/representers/object_representer.ex @@ -17,7 +17,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter do def to_map(%Object{data: %{"url" => url} = data}, _opts) when is_binary(url) do %{ url: url |> Pleroma.Web.MediaProxy.url(), - mimetype: data["mediaType"] || url["mimeType"], + mimetype: data["mediaType"] || data["mimeType"], id: data["uuid"], oembed: false, description: data["name"] |