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
a16b17cc
Commit
a16b17cc
authored
Jan 07, 2019
by
lain
Browse files
Actually put some onformation in the error user, make it actually properly parse
in conversations.
parent
74e10937
Pipeline
#6067
passed with stages
in 5 minutes and 56 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/twitter_api/views/activity_view.ex
View file @
a16b17cc
...
...
@@ -101,12 +101,14 @@ defp get_user(ap_id, opts) do
user
true
->
error_user
()
error_user
(
ap_id
)
end
end
defp
error_user
do
defp
error_user
(
ap_id
)
do
%
User
{
name:
ap_id
,
ap_id:
ap_id
,
info:
%
User
.
Info
{},
nickname:
"erroruser@example.com"
,
inserted_at:
NaiveDateTime
.
utc_now
()
...
...
test/web/twitter_api/views/activity_view_test.exs
View file @
a16b17cc
...
...
@@ -25,7 +25,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
import
Mock
test
"returns a
n error
user for activities missing users"
do
test
"returns a
temporary ap_id based
user for activities missing
db
users"
do
user
=
insert
(
:user
)
{
:ok
,
activity
}
=
CommonAPI
.
post
(
user
,
%{
"status"
=>
"Hey @shp!"
,
"visibility"
=>
"direct"
})
...
...
@@ -33,8 +33,11 @@ test "returns an error user for activities missing users" do
Repo
.
delete
(
user
)
Cachex
.
clear
(
:user_cache
)
result
=
ActivityView
.
render
(
"activity.json"
,
activity:
activity
)
assert
result
%{
"user"
=>
tw_user
}
=
ActivityView
.
render
(
"activity.json"
,
activity:
activity
)
assert
tw_user
[
"screen_name"
]
==
"erroruser@example.com"
assert
tw_user
[
"name"
]
==
user
.
ap_id
assert
tw_user
[
"statusnet_profile_url"
]
==
user
.
ap_id
end
test
"tries to get a user by nickname if fetching by ap_id doesn't work"
do
...
...
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