Merge develop into feature/770-add-emoji-tags
authorAlex S <alex.strizhakov@gmail.com>
Tue, 2 Apr 2019 12:16:29 +0000 (19:16 +0700)
committerAlex S <alex.strizhakov@gmail.com>
Tue, 2 Apr 2019 12:16:29 +0000 (19:16 +0700)
1  2 
config/config.exs
lib/pleroma/web/common_api/utils.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/twitter_api/controllers/util_controller.ex
test/web/mastodon_api/mastodon_api_controller_test.exs

Simple merge
Simple merge
index 3b10c4a1af3cf368fe4b501d94e4dd831bc4f5f1,1f3b268800fe843fcd6860c311a22788f0c36249..8be9ad98f36b2a0668dbb02bd729d433864ae2ed
@@@ -2266,19 -2266,29 +2266,45 @@@ defmodule Pleroma.Web.MastodonAPI.Masto
      end
    end
  
+   test "accounts fetches correct account for nicknames beginning with numbers", %{conn: conn} do
+     # Need to set an old-style integer ID to reproduce the problem
+     # (these are no longer assigned to new accounts but were preserved
+     # for existing accounts during the migration to flakeIDs)
+     user_one = insert(:user, %{id: 1212})
+     user_two = insert(:user, %{nickname: "#{user_one.id}garbage"})
+     resp_one =
+       conn
+       |> get("/api/v1/accounts/#{user_one.id}")
+     resp_two =
+       conn
+       |> get("/api/v1/accounts/#{user_two.nickname}")
+     resp_three =
+       conn
+       |> get("/api/v1/accounts/#{user_two.id}")
+     acc_one = json_response(resp_one, 200)
+     acc_two = json_response(resp_two, 200)
+     acc_three = json_response(resp_three, 200)
+     refute acc_one == acc_two
+     assert acc_two == acc_three
+   end
++
 +  describe "custom emoji" do
 +    test "with tags", %{conn: conn} do
 +      [emoji | _body] =
 +        conn
 +        |> get("/api/v1/custom_emojis")
 +        |> json_response(200)
 +
 +      assert Map.has_key?(emoji, "shortcode")
 +      assert Map.has_key?(emoji, "static_url")
 +      assert Map.has_key?(emoji, "tags")
 +      assert is_list(emoji["tags"])
 +      assert Map.has_key?(emoji, "url")
 +      assert Map.has_key?(emoji, "visible_in_picker")
 +    end
 +  end
  end