Merge branch 'develop' into fix/note-count-not-updating
[akkoma] / lib / pleroma / web / mastodon_api / mastodon_api_controller.ex
index 21b99f919e4bb70178f491a019bea9156c2fb0a4..c84c226e8176ab7ea28634df3cfb4d5adff2dc89 100644 (file)
@@ -212,9 +212,14 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
         |> Map.put("actor_id", ap_id)
         |> Map.put("whole_db", true)
 
-      activities =
-        ActivityPub.fetch_public_activities(params)
-        |> Enum.reverse()
+      if params["pinned"] == "true" do
+        # Since Pleroma has no "pinned" posts feature, we'll just set an empty list here
+        activities = []
+      else
+        activities =
+          ActivityPub.fetch_public_activities(params)
+          |> Enum.reverse()
+      end
 
       conn
       |> add_link_headers(:user_statuses, activities, params["id"])
@@ -516,7 +521,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
             ^query
           ),
         limit: 20,
-        order_by: [desc: :inserted_at]
+        order_by: [desc: :id]
       )
 
     statuses = Repo.all(q) ++ fetched
@@ -688,7 +693,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
   end
 
   def login_post(conn, %{"authorization" => %{"name" => name, "password" => password}}) do
-    with %User{} = user <- User.get_cached_by_nickname(name),
+    with %User{} = user <- User.get_by_nickname_or_email(name),
          true <- Pbkdf2.checkpw(password, user.password_hash),
          {:ok, app} <- get_or_make_app(),
          {:ok, auth} <- Authorization.create_authorization(app, user),