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
ac7580df
Commit
ac7580df
authored
Jan 16, 2018
by
lain
Browse files
Merge branch 'fix/background-profile-fetch' into 'develop'
Fetch external profile in the background. See merge request
!49
parents
80f6ac41
b3e7d7ae
Pipeline
#492
passed with stage
in 2 minutes and 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/twitter_api/twitter_api.ex
View file @
ac7580df
...
...
@@ -316,10 +316,12 @@ def conversation_id_to_context(id) do
def
get_external_profile
(
for_user
,
uri
)
do
with
{
:ok
,
%
User
{}
=
user
}
<-
OStatus
.
find_or_make_user
(
uri
)
do
with
url
<-
user
.
info
[
"topic"
],
{
:ok
,
%{
body:
body
}}
<-
@httpoison
.
get
(
url
,
[],
follow_redirect:
true
,
timeout:
10000
,
recv_timeout:
20000
)
do
OStatus
.
handle_incoming
(
body
)
end
spawn
(
fn
->
with
url
<-
user
.
info
[
"topic"
],
{
:ok
,
%{
body:
body
}}
<-
@httpoison
.
get
(
url
,
[],
follow_redirect:
true
,
timeout:
10000
,
recv_timeout:
20000
)
do
OStatus
.
handle_incoming
(
body
)
end
end
)
{
:ok
,
UserView
.
render
(
"show.json"
,
%{
user:
user
,
for:
for_user
})}
else
_e
->
{
:error
,
"Couldn't find user"
}
...
...
test/web/twitter_api/twitter_api_test.exs
View file @
ac7580df
...
...
@@ -404,7 +404,7 @@ test "fetches a user by uri" do
assert
represented
[
"id"
]
==
UserView
.
render
(
"show.json"
,
%{
user:
remote
,
for:
user
})[
"id"
]
# Also fetches the feed.
assert
Activity
.
get_create_activity_by_object_ap_id
(
"tag:mastodon.social,2017-04-05:objectId=1641750:objectType=Status"
)
#
assert Activity.get_create_activity_by_object_ap_id("tag:mastodon.social,2017-04-05:objectId=1641750:objectType=Status")
end
end
end
Write
Preview
Supports
Markdown
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