From: lain Date: Tue, 27 Nov 2018 17:31:44 +0000 (+0100) Subject: Webfinger fixes. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=3c61df6b9ed4f66f0cc6ae6f1e7e167f7bfb2210;p=akkoma Webfinger fixes. --- diff --git a/lib/pleroma/web/web_finger/web_finger.ex b/lib/pleroma/web/web_finger/web_finger.ex index 5bf529840..eaee3a8c6 100644 --- a/lib/pleroma/web/web_finger/web_finger.ex +++ b/lib/pleroma/web/web_finger/web_finger.ex @@ -45,7 +45,7 @@ defmodule Pleroma.Web.WebFinger do def represent_user(user, "JSON") do {:ok, user} = ensure_keys_present(user) - {:ok, _private, public} = Salmon.keys_from_pem(user.info["keys"]) + {:ok, _private, public} = Salmon.keys_from_pem(user.info.keys) magic_key = Salmon.encode_key(public) %{ @@ -83,7 +83,7 @@ defmodule Pleroma.Web.WebFinger do def represent_user(user, "XML") do {:ok, user} = ensure_keys_present(user) - {:ok, _private, public} = Salmon.keys_from_pem(user.info["keys"]) + {:ok, _private, public} = Salmon.keys_from_pem(user.info.keys) magic_key = Salmon.encode_key(public) { diff --git a/test/web/web_finger/web_finger_test.exs b/test/web/web_finger/web_finger_test.exs index 99bf210ea..28d429565 100644 --- a/test/web/web_finger/web_finger_test.exs +++ b/test/web/web_finger/web_finger_test.exs @@ -99,15 +99,15 @@ defmodule Pleroma.Web.WebFingerTest do describe "ensure_keys_present" do test "it creates keys for a user and stores them in info" do user = insert(:user) - refute is_binary(user.info["keys"]) + refute is_binary(user.info.keys) {:ok, user} = WebFinger.ensure_keys_present(user) - assert is_binary(user.info["keys"]) + assert is_binary(user.info.keys) end test "it doesn't create keys if there already are some" do - user = insert(:user, %{info: %{"keys" => "xxx"}}) + user = insert(:user, %{info: %{keys: "xxx"}}) {:ok, user} = WebFinger.ensure_keys_present(user) - assert user.info["keys"] == "xxx" + assert user.info.keys == "xxx" end end end