From: Alex S Date: Tue, 2 Apr 2019 12:16:29 +0000 (+0700) Subject: Merge develop into feature/770-add-emoji-tags X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=9e0567ec5237fc7a2ba37f5291962f3c58fd21f8;p=akkoma Merge develop into feature/770-add-emoji-tags --- 9e0567ec5237fc7a2ba37f5291962f3c58fd21f8 diff --cc test/web/mastodon_api/mastodon_api_controller_test.exs index 3b10c4a1a,1f3b26880..8be9ad98f --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@@ -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