From 1dd2c8163f233a205d6f110af010a637403e163e Mon Sep 17 00:00:00 2001 From: lain Date: Tue, 10 Apr 2018 18:38:52 +0200 Subject: [PATCH] Order masto searches by date. --- .../mastodon_api/mastodon_api_controller.ex | 64 ++++++++++--------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index b00f1e15c..21b99f919 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -515,7 +515,8 @@ def search(%{assigns: %{user: user}} = conn, %{"q" => query} = params) do a.data, ^query ), - limit: 20 + limit: 20, + order_by: [desc: :inserted_at] ) statuses = Repo.all(q) ++ fetched @@ -605,35 +606,37 @@ def index(%{assigns: %{user: user}} = conn, _params) do "video\/mp4" ] }, - settings: Map.get(user.info, "settings") || %{ - onboarded: true, - home: %{ - shows: %{ - reblog: true, - reply: true - } - }, - notifications: %{ - alerts: %{ - follow: true, - favourite: true, - reblog: true, - mention: true + settings: + Map.get(user.info, "settings") || + %{ + onboarded: true, + home: %{ + shows: %{ + reblog: true, + reply: true + } + }, + notifications: %{ + alerts: %{ + follow: true, + favourite: true, + reblog: true, + mention: true + }, + shows: %{ + follow: true, + favourite: true, + reblog: true, + mention: true + }, + sounds: %{ + follow: true, + favourite: true, + reblog: true, + mention: true + } + } }, - shows: %{ - follow: true, - favourite: true, - reblog: true, - mention: true - }, - sounds: %{ - follow: true, - favourite: true, - reblog: true, - mention: true - } - } - }, push_subscription: nil, accounts: accounts, custom_emojis: mastodon_emoji, @@ -656,7 +659,8 @@ def put_settings(%{assigns: %{user: user}} = conn, %{"data" => settings} = _para {:ok, _user} <- User.update_and_set_cache(change) do conn |> json(%{}) - else e -> + else + e -> conn |> json(%{error: inspect(e)}) end