Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
c51e1597
Commit
c51e1597
authored
May 07, 2017
by
lain
Browse files
Fix user fetching error.
parent
ff2945df
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/ostatus/ostatus.ex
View file @
c51e1597
...
@@ -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
)
...
...
test/web/ostatus/ostatus_test.exs
View file @
c51e1597
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment