Order masto searches by date.
authorlain <lain@soykaf.club>
Tue, 10 Apr 2018 16:38:52 +0000 (18:38 +0200)
committerlain <lain@soykaf.club>
Tue, 10 Apr 2018 16:38:52 +0000 (18:38 +0200)
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex

index b00f1e15c1a58506e02f597fb4b821f7c9040410..21b99f919e4bb70178f491a019bea9156c2fb0a4 100644 (file)
@@ -515,7 +515,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
             a.data,
             ^query
           ),
-        limit: 20
+        limit: 20,
+        order_by: [desc: :inserted_at]
       )
 
     statuses = Repo.all(q) ++ fetched
@@ -605,35 +606,37 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController 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 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
          {:ok, _user} <- User.update_and_set_cache(change) do
       conn
       |> json(%{})
-    else e ->
+    else
+      e ->
         conn
         |> json(%{error: inspect(e)})
     end