Commit c51e1597 authored by lain's avatar lain
Browse files

Fix user fetching error.

parent ff2945df
...@@ -195,7 +195,7 @@ def find_make_or_update_user(doc) do ...@@ -195,7 +195,7 @@ def find_make_or_update_user(doc) do
def find_or_make_user(uri) do def find_or_make_user(uri) do
query = from user in User, query = from user in User,
where: user.local == false and fragment("? @> ?", user.info, ^%{uri: uri}) where: user.ap_id == ^uri
user = Repo.one(query) user = Repo.one(query)
......
...@@ -140,8 +140,14 @@ test "handle incoming replies" do ...@@ -140,8 +140,14 @@ test "handle incoming replies" do
end end
describe "new remote user creation" do describe "new remote user creation" do
test "returns local users" do
local_user = insert(:user)
{:ok, user} = OStatus.find_or_make_user(local_user.ap_id)
assert user == local_user
end
test "tries to use the information in poco fields" do test "tries to use the information in poco fields" do
# TODO make test local
uri = "https://social.heldscal.la/user/23211" uri = "https://social.heldscal.la/user/23211"
{:ok, user} = OStatus.find_or_make_user(uri) {:ok, user} = OStatus.find_or_make_user(uri)
...@@ -160,7 +166,6 @@ test "tries to use the information in poco fields" do ...@@ -160,7 +166,6 @@ test "tries to use the information in poco fields" do
end end
test "find_make_or_update_user takes an author element and returns an updated user" do test "find_make_or_update_user takes an author element and returns an updated user" do
# TODO make test local
uri = "https://social.heldscal.la/user/23211" uri = "https://social.heldscal.la/user/23211"
{:ok, user} = OStatus.find_or_make_user(uri) {:ok, user} = OStatus.find_or_make_user(uri)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment