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
e03d24af
Commit
e03d24af
authored
Apr 12, 2019
by
Alexander Strizhakov
Committed by
kaniini
Apr 12, 2019
Browse files
in_reply_to_id - null
parent
31c06dba
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/web/mastodon_api/views/status_view.ex
View file @
e03d24af
...
...
@@ -301,8 +301,10 @@ def render("attachment.json", %{attachment: attachment}) do
end
def
get_reply_to
(
activity
,
%{
replied_to_activities:
replied_to_activities
})
do
_id
=
activity
.
data
[
"object"
][
"inReplyTo"
]
replied_to_activities
[
activity
.
data
[
"object"
][
"inReplyTo"
]]
with
nil
<-
replied_to_activities
[
activity
.
data
[
"object"
][
"inReplyTo"
]]
do
# If user didn't participate in the thread
Activity
.
get_in_reply_to_activity
(
activity
)
end
end
def
get_reply_to
(%{
data:
%{
"object"
=>
object
}},
_
)
do
...
...
test/web/mastodon_api/mastodon_api_controller_test.exs
View file @
e03d24af
...
...
@@ -2653,4 +2653,49 @@ test "deletes a scheduled activity", %{conn: conn} do
assert
%{
"error"
=>
"Record not found"
}
=
json_response
(
res_conn
,
404
)
end
end
test
"Repeated posts that are replies incorrectly have in_reply_to_id null"
,
%{
conn:
conn
}
do
user1
=
insert
(
:user
)
user2
=
insert
(
:user
)
user3
=
insert
(
:user
)
{
:ok
,
replied_to
}
=
TwitterAPI
.
create_status
(
user1
,
%{
"status"
=>
"cofe"
})
# Reply to status from another user
conn1
=
conn
|>
assign
(
:user
,
user2
)
|>
post
(
"/api/v1/statuses"
,
%{
"status"
=>
"xD"
,
"in_reply_to_id"
=>
replied_to
.
id
})
assert
%{
"content"
=>
"xD"
,
"id"
=>
id
}
=
json_response
(
conn1
,
200
)
activity
=
Activity
.
get_by_id
(
id
)
assert
activity
.
data
[
"object"
][
"inReplyTo"
]
==
replied_to
.
data
[
"object"
][
"id"
]
assert
activity
.
data
[
"object"
][
"inReplyToStatusId"
]
==
replied_to
.
id
# Reblog from the third user
conn2
=
conn
|>
assign
(
:user
,
user3
)
|>
post
(
"/api/v1/statuses/
#{
activity
.
id
}
/reblog"
)
assert
%{
"reblog"
=>
%{
"id"
=>
id
,
"reblogged"
=>
true
,
"reblogs_count"
=>
1
}}
=
json_response
(
conn2
,
200
)
assert
to_string
(
activity
.
id
)
==
id
# Getting third user status
conn3
=
conn
|>
assign
(
:user
,
user3
)
|>
get
(
"api/v1/timelines/home"
)
[
reblogged_activity
]
=
json_response
(
conn3
,
200
)
assert
reblogged_activity
[
"reblog"
][
"in_reply_to_id"
]
==
replied_to
.
id
replied_to_user
=
User
.
get_by_ap_id
(
replied_to
.
data
[
"actor"
])
assert
reblogged_activity
[
"reblog"
][
"in_reply_to_account_id"
]
==
replied_to_user
.
id
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