X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fmastodon_api%2Fmastodon_api_controller.ex;h=82887966c257469d87247f9d8229c7c4f33044ba;hb=5f35fdcf5d7bc0dc6054eda06d565268f9e79b33;hp=a3587ff4459b4cc7e7c9130f72dc4e3b1077f9ef;hpb=a6f65083aeed755d31134144b973d87575ae549e;p=akkoma diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index a3587ff44..82887966c 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -106,7 +106,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do user_count: 1, status_count: 2, domain_count: 3 - } + }, + max_toot_chars: Keyword.get(@instance, :limit) } json(conn, response) @@ -196,6 +197,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do with %Activity{} = activity <- Repo.get(Activity, id), activities <- ActivityPub.fetch_activities_for_context(activity.data["object"]["context"], %{"blocking_user" => user}), activities <- activities |> Enum.filter(fn (%{id: aid}) -> to_string(aid) != to_string(id) end), + activities <- activities |> Enum.filter(fn (%{data: %{"type" => type}}) -> type == "Create" end), grouped_activities <- Enum.group_by(activities, fn (%{id: id}) -> id < activity.id end) do result = %{ ancestors: StatusView.render("index.json", for: user, activities: grouped_activities[true] || [], as: :activity) |> Enum.reverse, @@ -557,7 +559,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do def login(conn, _) do conn - |> render(MastodonView, "login.html") + |> render(MastodonView, "login.html", %{error: false}) end defp get_or_make_app() do @@ -579,9 +581,19 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do conn |> put_session(:oauth_token, token.token) |> redirect(to: "/web/getting-started") + else + _e -> + conn + |> render(MastodonView, "login.html", %{error: "Wrong username or password"}) end end + def logout(conn, _) do + conn + |> clear_session + |> redirect(to: "/") + end + def relationship_noop(%{assigns: %{user: user}} = conn, %{"id" => id}) do Logger.debug("Unimplemented, returning unmodified relationship") with %User{} = target <- Repo.get(User, id) do